05 2020 档案
摘要:1. 可以实现数据驱动,但是数据驱动和json文件不通用 json文件获取数据:cy.fixture('login/login.json').as("login_json") json提供数据更适合全局变量 数据驱动获取数据:var testData = [1,2,3] testData.forEa
阅读全文
摘要:通过css定位前端元素 前端页面代码如下: <html> <body> <div class="formdiv"> <form name="fnfn"> <input name="username" type="text"></input> <input name="password" type="
阅读全文
摘要:这次讲怎么使用Xpath定位元素 1. 绝对定位(不推荐) 使用copy就能实现元素绝对定位:/html/body/div/blockquote/div[2]/div[1]/div[1]/div/button[1]/i 2. 相对定位(推荐) 1. 标签名 //form 2. 标签名+属性名+属性值
阅读全文
摘要:1、针对UI自动化测试,最基础的内容是:元素定位。只有定位到了元素后,才能对其进行相应的操作 2、那么我们常见的几种定位方式有哪些呢 1. by id JS写法:document.getElementById("serviceCode"); selenium写法:driver.find_elemen
阅读全文
摘要:1. 本地新增项目 touch README.md git init git add README.md git commit -m "first commit" git remote add origin https://XXX.git 仓库地址 git push -u origin master
阅读全文
摘要:1 class SearchLinkJson(APIView): 2 """搜索""" 3 def post(self, request): 4 """前端提交表单后,获取表单数据, 组成一个dict,再用filter过滤""" 5 json_data = simplejson.loads(requ
阅读全文
摘要:前端传一个需要删除的id,list,后端拿到这个list进行删除 1 class DeleteLinkMoreDataJson(APIView): 2 3 def post(self, request): 4 data = simplejson.loads(request.body) 5 data_
阅读全文
摘要:单条数据编辑 1 class EditLinkJson(APIView): 2 3 def post(self, request): 4 json_data = simplejson.loads(request.body) 5 print(json_data) 6 try: 7 id = Link.
阅读全文
摘要:1 from rest_framework.views import APIView 2 3 4 class DeleteLinkDataJson(APIView): 5 6 def post(self, request): 7 # 获取ulr中的参数 request.path 8 id = req
阅读全文
摘要:1 from rest_framework.views import APIView 2 import simplejson 3 4 5 class AddLinkJson(APIView): 6 7 def post(self, request): 8 json_data = simplejson
阅读全文
摘要:1 from rest_framework.views import APIView 2 3 4 class GetLinkListDataJson(APIView): 5 """ 6 列表页获取table信息,包含分页 7 """ 8 def get(self, request): 9 page
阅读全文
摘要:1 # -*- coding: utf-8 -*- 2 from dss.Serializer import serializer 3 from django.http import HttpResponse 4 5 6 def response_as_json(data, foreign_pene
阅读全文
摘要:背景: 需要做一个列表页,管理内部所有链接 思路:先用前端画出列表页,然后实现列表的功能 列表页:layui自带的方法渲染,不需要过多的HTML直接JS渲染 功能:新增、删除、查看、编辑、搜索、分页 功能实现:前端数据提供给后端处理,渲染返回结果 首先,上一段前端代码,具体解析在页面中有注释 更新数
阅读全文
摘要:.......开发页面,省略 1、设置settings ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'XXX.168.XX.XXX', '*', ] 2、使用终端开启本地服务 Python manage.py runserver XXX.168.XX.XXX
阅读全文
摘要:背景: 在使用Django做列表页时,需要用到增删改查,在新增的时候用到了layui.open的弹出层。将新增页面当做一个iframe嵌入到列表页,使用layui.open的btn制作按钮,并且实现提交表单的功能 实现: 先用HTML话列表页和新增页面的图表,列表页 1 {% extends 'le
阅读全文
摘要:在Django项目中,我们需要用到数据库时,通常有两种方式实现创建和同步数据库 1、直接在models.py文件中写方法,然后再同步到数据库中 class UserName(models.Model): id = models.IntegerField() name = models.CharFie
阅读全文