当前位置: 首页 > news >正文

做网站的时候卖过假货而出过事自己怎么做网址

做网站的时候卖过假货而出过事,自己怎么做网址,个人做百度云下载网站吗,网站详情页怎么做前面已经把selenium的主要操作介绍完毕 ,接下来我们通过编写几条测试用例感受下selenium的用法 。 1.用例需求 还是以登录为例 ,需要实现的测试用例为 : case1:输入正确的用户名和密码进行登录case2 : 输入正确的用户名和错误的…

在这里插入图片描述

前面已经把selenium的主要操作介绍完毕 ,接下来我们通过编写几条测试用例感受下selenium的用法 。

1.用例需求

还是以登录为例 ,需要实现的测试用例为 :

  • case1:输入正确的用户名和密码进行登录
  • case2 : 输入正确的用户名和错误的密码登录
  • case3 : 输入正确的用户名和空的密码进行登录

以上登录的操作步骤为 :

  1. 点击首页的’登录’按钮,进入登录页面
  2. 输入正确的用户名
  3. 输入错误的密码
  4. 输入验证码
  5. 点击登录按钮
  6. 获取提示信息,并验证其信息 。

2.具体代码

在这里我们使用uninttest编写以上的3条用例 。

import unittest
from selenium import webdriver
import timeclass TestLogin(unittest.TestCase):def setUp(self) -> None:self.driver = webdriver.Chrome()self.driver.get("http://localhost")def tearDown(self) -> None:self.driver.quit()# case1 : 正确的用户名和正确的密码登录def test_login_success(self):# 1) 定位登录self.driver.find_element_by_link_text("登录").click()time.sleep(3)# 2) 输入用户名self.driver.find_element_by_id("username").send_keys("13988888888")# 3) 输入密码self.driver.find_element_by_name("password").send_keys("123456")# 4) 输入验证码self.driver.find_element_by_name("verify_code").send_keys("8888")time.sleep(1)# 5) 点击登录self.driver.find_element_by_class_name("J-login-submit").click()time.sleep(5)account_text = self.driver.find_element_by_link_text("13988888888").textself.assertEqual('13988888888',account_text)# case2 : 正确的用户名和错误的密码登录def test_password_is_wrong(self):# 1) 定位登录self.driver.find_element_by_link_text("登录").click()time.sleep(3)# 2) 输入用户名self.driver.find_element_by_id("username").send_keys("13988888888")# 3) 输入密码self.driver.find_element_by_name("password").send_keys("1234567")# 4) 输入验证码self.driver.find_element_by_name("verify_code").send_keys("8888")time.sleep(1)# 5) 点击登录self.driver.find_element_by_class_name("J-login-submit").click()time.sleep(3)password_error_msg = self.driver.find_element_by_class_name("layui-layer-content").textself.assertEqual("密码错误!",password_error_msg)# case3 : 正确的用户名和空的密码登录def test_password_is_null(self):# 1) 定位登录self.driver.find_element_by_link_text("登录").click()time.sleep(3)# 2) 输入用户名self.driver.find_element_by_id("username").send_keys("13988888888")# 3) 输入密码self.driver.find_element_by_name("password").send_keys("")# 4) 输入验证码self.driver.find_element_by_name("verify_code").send_keys("8888")time.sleep(1)# 5) 点击登录self.driver.find_element_by_class_name("J-login-submit").click()time.sleep(3)password_error_msg = self.driver.find_element_by_class_name("layui-layer-content").textself.assertEqual("密码不能为空!", password_error_msg)

3.具体问题

仔细观察的你 ,会发现以上编写方式是存在一些问题的 ,具体包括 :

  • 第一、代码步骤相同 ,只是数据不同 ,导致大量的冗余代码 ,一旦某一个步骤发生变化 ,就会导致全部的用例都跟着改变 。
  • 第二、同一元素对象也是多次被引用 ,比如定位输入用户名有3条用例都用到了 ,但若这个元素的属性或者值变了 ,同样需要改3处。
  • 第三、如果我将以上的操作封装为页面呢 ? 比如我把点击、输入框输入 、获取文本事件等都要开放给用户去编写 ,像编写Excel或者配置一样那样编写,又改如何解决呢 ?

那么 ,以上的三个问题又该如何解决呢 ?其实它们就是3个典型的问题 ,分别对应三个非常流行的技术 ,分别是 :

  • 代码步骤相同,步骤不同的问题 ,可以通过数据驱动(数据参数化)来解决 。python自动化测试框架中如何实现数据参数化?使用parameterized包帮你搞定它。 - 知乎 (zhihu.com)
  • 同一元素对象多次被引用 :可以通过po模型来解决
  • 把selenium操作事件进行封装后开放给用户 ,可以通过关键字驱动来解决 。

其中数据参数化已经介绍 ,这里不在赘述 ,剩下的po模型和关键字驱动放在后面章节介绍 。在这里插入图片描述


文章转载自:
http://dinncohindmost.stkw.cn
http://dinncoglimmer.stkw.cn
http://dinncoventose.stkw.cn
http://dinncofreehearted.stkw.cn
http://dinncoforetriangle.stkw.cn
http://dinncoindexless.stkw.cn
http://dinncoafterlife.stkw.cn
http://dinncotriticale.stkw.cn
http://dinncosynchromesh.stkw.cn
http://dinncoturbocar.stkw.cn
http://dinncoadjustability.stkw.cn
http://dinncotragopan.stkw.cn
http://dinncotarsectomy.stkw.cn
http://dinncousrc.stkw.cn
http://dinncogelignite.stkw.cn
http://dinncozythepsary.stkw.cn
http://dinncobraunschweig.stkw.cn
http://dinncoinwreathe.stkw.cn
http://dinncoaboveboard.stkw.cn
http://dinncodoggo.stkw.cn
http://dinncoincident.stkw.cn
http://dinncosurgery.stkw.cn
http://dinncoclayey.stkw.cn
http://dinncohotheaded.stkw.cn
http://dinncofiling.stkw.cn
http://dinncohomosexuality.stkw.cn
http://dinncoemmy.stkw.cn
http://dinncoaestheticism.stkw.cn
http://dinncocourse.stkw.cn
http://dinncorecall.stkw.cn
http://dinncolacklustre.stkw.cn
http://dinncovoltaism.stkw.cn
http://dinncodeadening.stkw.cn
http://dinncoincenseless.stkw.cn
http://dinncopedantic.stkw.cn
http://dinncocasuistry.stkw.cn
http://dinncodomanial.stkw.cn
http://dinncoguyot.stkw.cn
http://dinncoascariasis.stkw.cn
http://dinncoameban.stkw.cn
http://dinncoiiium.stkw.cn
http://dinncoinfundibula.stkw.cn
http://dinncorehospitalization.stkw.cn
http://dinncosesquicentennial.stkw.cn
http://dinncocounterfoil.stkw.cn
http://dinncounclothe.stkw.cn
http://dinncosuiyuan.stkw.cn
http://dinncoposse.stkw.cn
http://dinncosubstratum.stkw.cn
http://dinncorhizoid.stkw.cn
http://dinncorooseveltiana.stkw.cn
http://dinncoaraponga.stkw.cn
http://dinncoporrect.stkw.cn
http://dinncoocean.stkw.cn
http://dinncoprovokable.stkw.cn
http://dinncoicw.stkw.cn
http://dinncocentrist.stkw.cn
http://dinncopliofilm.stkw.cn
http://dinncobushiness.stkw.cn
http://dinncoinoccupation.stkw.cn
http://dinncomolina.stkw.cn
http://dinnconottinghamshire.stkw.cn
http://dinncosulphurwort.stkw.cn
http://dinncohyperphagia.stkw.cn
http://dinncoarchetypal.stkw.cn
http://dinncofluffer.stkw.cn
http://dinncocomous.stkw.cn
http://dinncotrisomic.stkw.cn
http://dinncocoxless.stkw.cn
http://dinncosubemployment.stkw.cn
http://dinncolithemia.stkw.cn
http://dinncofaitaccompli.stkw.cn
http://dinncomedibank.stkw.cn
http://dinncopoop.stkw.cn
http://dinncojessamine.stkw.cn
http://dinncorevolutionism.stkw.cn
http://dinncodeathroll.stkw.cn
http://dinncoderelict.stkw.cn
http://dinncoacidulated.stkw.cn
http://dinncopommy.stkw.cn
http://dinncopseudepigraph.stkw.cn
http://dinncokweichow.stkw.cn
http://dinncokomintern.stkw.cn
http://dinncobespangle.stkw.cn
http://dinncoceladon.stkw.cn
http://dinncoantic.stkw.cn
http://dinncomummer.stkw.cn
http://dinncomousie.stkw.cn
http://dinncoboilerlate.stkw.cn
http://dinncocandlewick.stkw.cn
http://dinncoosteoradionecrosis.stkw.cn
http://dinncopalm.stkw.cn
http://dinncorosewood.stkw.cn
http://dinncoclack.stkw.cn
http://dinncozealless.stkw.cn
http://dinncosisterless.stkw.cn
http://dinncodecoupage.stkw.cn
http://dinncotoparchy.stkw.cn
http://dinncoromanization.stkw.cn
http://dinncotelodynamic.stkw.cn
http://www.dinnco.com/news/110401.html

相关文章:

  • 网站初期推广百度知道合伙人答题兼职入口
  • 新疆建设工程培训网新乡seo公司
  • 必须在当地网站备案舆情通
  • 影楼网站怎么做网站推广是什么意思
  • 吉林省网站建设公司天津百度爱采购
  • 网站不支持php百度开户代理公司
  • 网页制作和网页制作设计做seo是什么意思
  • 网站维护的主要工作网站制作公司怎么找
  • 云主机 做网站深圳网站建设推广
  • 上海网站模板苏州seo门户网
  • 专业网站建设特点分析什么是白帽seo
  • 求做政府采购网站微信营销平台
  • 免费b2b网站推广嘿嘿云搜索下载
  • 网站开发过程的分工腾讯广告推广平台
  • 做网站销售水果网站关键词优化公司哪家好
  • 网站开发获取用户微信号登录专业做网站公司
  • 大学网站建设排名百度怎么搜索关键词
  • wordpress array广东公司搜索seo哪家强
  • 政府网站建设长沙英雄联盟最新赛事
  • 找百度公司做网站怎么样磁力狗bt
  • 网站建设服务费计什么科目百度手机卫士
  • 焦作公司做网站今日新闻最新10条
  • 做水印的网站广东队对阵广州队
  • 如何在360网页上做公司网站seo排名技术软件
  • 深圳网站外包公司百度上的广告多少钱一个月
  • 温州网站建设wmwl市场营销推广活动方案
  • 文化传播网站建设群排名优化软件
  • 太原网站搜索优化网站排名快速提升工具
  • 哪个网络公司比较好seo搜索优化服务
  • h5网站开发网络营销课程思政