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

江阴哪里有做网站推广百度数据

江阴哪里有做网站推广,百度数据,岳阳网站项目建设报道,广州注册公司代办一、弹出框实战 1、在UI自动化测试中经常会遇到Alert弹出框的场景。Alert类是对话框的处理,主要是对alert警告框。confirm确认框,promp消息对话框。 text():获取alert的文本 dismiss ():点击取消 accept():接受 send-keys():输入 from selenium import …

一、弹出框实战
1、在UI自动化测试中经常会遇到Alert弹出框的场景。Alert类是对话框的处理,主要是对alert警告框。confirm确认框,promp消息对话框。

  text():获取alert的文本

  dismiss ():点击取消

  accept():接受

  send-keys():输入

from selenium import webdriver
from selenium.webdriver.common.alert import Alert
import time as t
"""获取alert警告框的文本信息"""
driver=webdriver.Chrome()
driver.maximize_window()
driver.get('file:///D:/code/app/01.html')
print('获取alert的文本信息:',driver.switch_to.alert.text)
t.sleep(3)
driver.switch_to.alert.accept()
t.sleep(3)
driver.quit()获取alert的文本信息: 无涯课堂为您服务!

 

from selenium import webdriver
from selenium.webdriver.common.alert import Alert
import time as t"""确认框的处理"""
driver=webdriver.Chrome()
driver.maximize_window()
driver.get('file:///D:/code/app/confi.html')
driver.find_element_by_xpath('/html/body/input').click()
driver.switch_to.alert.accept()
t.sleep(5)
# 刷新页面
driver.refresh()
t.sleep(3)
driver.find_element_by_xpath('/html/body/input').click()
driver.switch_to.alert.dismiss()
t.sleep(3)
driver.quit()
from selenium import webdriver
from selenium.webdriver.common.alert import Alert
import time as t"""消息对话框输入信息"""
driver=webdriver.Chrome()
driver.maximize_window()
driver.get('file:///D:/code/app/prompt.html')
driver.find_element_by_xpath('/html/body/input').click()
driver.switch_to.alert.send_keys('无涯课堂为您服务!')
t.sleep(5)
# 点击取消
driver.switch_to.alert.dismiss()
t.sleep(5)
driver.find_element_by_xpath('/html/body/input').click()
# 再一次输入
driver.switch_to.alert.send_keys('无涯课堂为您服务!')
t.sleep(5)
driver.switch_to.alert.accept()
t.sleep(5)
driver.quit()

二、Sina实战

from selenium import webdriver
import time as t"""sina实战"""
driver=webdriver.Chrome()
driver.maximize_window()
driver.get('https://mail.sina.com.cn/')
# 输入用户名
driver.find_element_by_id('freename').send_keys('wuya1303@sina.com')
t.sleep(3)
# 输入密码
driver.find_element_by_xpath('//*[@id="freepassword"]').send_keys('admin123')
t.sleep(3)
# 点击登录按钮
driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div/div[4]/div[1]/div[1]/div[7]/div[1]/a[1]').click()
t.sleep(3)
# 获取nick
nick=driver.find_element_by_xpath('//*[@id="navParent"]/li[1]/a/span/em').text
print('nick信息:',nick)
assert nick=="邮箱首页"
# 点击写信按钮
driver.find_element_by_xpath('//*[@id="coreBtn"]/ul/li[1]/a').click()
t.sleep(3)
# 输入收件人 断言
inputText=driver.find_element_by_xpath('//*[@id="tr_to"]/td/ul/li/input')
inputText.send_keys('wuya1303@sina.com')
assert inputText.get_attribute('value')=='wuya1303@sina.com'driver.switch_to.frame
t.sleep(3)
driver.quit()

三、QQ邮箱错误信息的验证

from selenium import webdriver
import time as tdriver=webdriver.Chrome()
driver.maximize_window()
driver.get('https://mail.qq.com/')
driver.switch_to.frame('login_frame')
driver.find_element_by_id('u').send_keys('734398143')
t.sleep(3)
driver.find_element_by_xpath('//*[@id="p"]').send_keys('asdf')
driver.find_element_by_xpath('//*[@id="login_button"]').click()
t.sleep(3)
errorText=driver.find_element_by_xpath('//*[@id="err_m"]')
assert errorText.text=='你输入的帐号或密码不正确,请重新输入。'
driver.quit()

四、新浪邮箱错误信息的验证

1、账户密码都为空

from selenium import webdriver
import time as tdriver=webdriver.Chrome()
driver.maximize_window()
driver.get('https://mail.sina.com.cn/#')
"""错误信息验证 用户名和密码都为空"""
driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div/div[4]/div[1]/div[1]/div[7]/div[1]/a[1]').click()
errorText=driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div/div[4]/div[1]/div[1]/div[1]/span[1]')
assert errorText.text=='请输入邮箱名'
t.sleep(3)
driver.quit()

2、密码为空

from selenium import webdriver
import time as tdriver=webdriver.Chrome()
driver.maximize_window()
driver.get('https://mail.sina.com.cn/#')
"""密码为空"""
driver.find_element_by_id('freename').send_keys('wuya1303@sina.com')
t.sleep(3)
driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div/div[4]/div[1]/div[1]/div[7]/div[1]/a[1]').click()
errorText=driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div/div[4]/div[1]/div[1]/div[1]/span[2]')
assert errorText.text=='请输入密码'
t.sleep(3)
driver.quit()

3、账户为空

from selenium import webdriver
import time as tdriver=webdriver.Chrome()
driver.maximize_window()
driver.get('https://mail.sina.com.cn/#')
"""邮箱名为空"""
driver.find_element_by_xpath('//*[@id="freepassword"]').send_keys('admin123')
t.sleep(3)
driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div/div[4]/div[1]/div[1]/div[7]/div[1]/a[1]').click()
errorText=driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div/div/div[4]/div[1]/div[1]/div[1]/span[1]')
assert errorText.text=='请输入邮箱名'
t.sleep(3)
driver.quit()

五、忘记密码的验证 多窗口

from selenium import webdriver
import time as t"""测试忘记密码"""
driver=webdriver.Chrome()
driver.maximize_window()
driver.get('https://mail.sina.com.cn/#')
nowHandler=driver.current_window_handle
driver.find_element_by_link_text('忘记密码?').click()
allHandler=driver.window_handles
for handler in allHandler:if handler!=nowHandler:driver.switch_to.window(handler)url=driver.current_urlprint(url.endswith('entry=freemail'))assert url.endswith('entry=freemail')==Truedriver.close()
driver.switch_to.window(nowHandler)
t.sleep(3)
driver.quit()
总结:

感谢每一个认真阅读我文章的人!!!

作为一位过来人也是希望大家少走一些弯路,如果你不想再体验一次学习时找不到资料,没人解答问题,坚持几天便放弃的感受的话,在这里我给大家分享一些自动化测试的学习资源,希望能给你前进的路上带来帮助

文档获取方式

加入我的软件测试交流群:632880530免费获取~(同行大佬一起学术交流,每晚都有大佬直播分享技术知识点)

这份文档,对于想从事【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴我走过了最艰难的路程,希望也能帮助到你!

以上均可以分享,只需要你搜索vx公众号:程序员雨果,即可免费领取


文章转载自:
http://dinncoacquirement.knnc.cn
http://dinncodragline.knnc.cn
http://dinncomagnificence.knnc.cn
http://dinncopaleocrystic.knnc.cn
http://dinncomotility.knnc.cn
http://dinncoexpensively.knnc.cn
http://dinncoattorn.knnc.cn
http://dinncotoadeating.knnc.cn
http://dinncojagt.knnc.cn
http://dinncotribesman.knnc.cn
http://dinncomaximite.knnc.cn
http://dinncoplumbicon.knnc.cn
http://dinncoxylology.knnc.cn
http://dinncosupplementarity.knnc.cn
http://dinncophotonovel.knnc.cn
http://dinncoroweite.knnc.cn
http://dinncopillory.knnc.cn
http://dinncofrothy.knnc.cn
http://dinncowatercolor.knnc.cn
http://dinncoclonus.knnc.cn
http://dinncogermiparity.knnc.cn
http://dinncofilm.knnc.cn
http://dinncomontmorency.knnc.cn
http://dinncogigaton.knnc.cn
http://dinncofacture.knnc.cn
http://dinncostanchly.knnc.cn
http://dinncoelectromer.knnc.cn
http://dinncotroy.knnc.cn
http://dinncoplutocrat.knnc.cn
http://dinncocaryatid.knnc.cn
http://dinncomutagenize.knnc.cn
http://dinncomindless.knnc.cn
http://dinncoshrill.knnc.cn
http://dinncoclarinetist.knnc.cn
http://dinncoundesired.knnc.cn
http://dinncosolleret.knnc.cn
http://dinncookeh.knnc.cn
http://dinncoweighlock.knnc.cn
http://dinncomoharram.knnc.cn
http://dinncocracky.knnc.cn
http://dinncooxalic.knnc.cn
http://dinncopentastich.knnc.cn
http://dinncoyellowthroat.knnc.cn
http://dinncometayer.knnc.cn
http://dinncoterawatt.knnc.cn
http://dinncoomnitude.knnc.cn
http://dinncopandemoniac.knnc.cn
http://dinncoxerophilous.knnc.cn
http://dinncooberon.knnc.cn
http://dinncoprocathedral.knnc.cn
http://dinncocharmed.knnc.cn
http://dinncophallism.knnc.cn
http://dinncojuvenile.knnc.cn
http://dinncogameland.knnc.cn
http://dinncosabbatarianism.knnc.cn
http://dinncomeningoencephalitis.knnc.cn
http://dinncoenteralgia.knnc.cn
http://dinncotombouctou.knnc.cn
http://dinncoaffinitive.knnc.cn
http://dinncoretinae.knnc.cn
http://dinncounaligned.knnc.cn
http://dinncoguadalcanal.knnc.cn
http://dinncowoofy.knnc.cn
http://dinncoascorbate.knnc.cn
http://dinncofrothy.knnc.cn
http://dinncoroue.knnc.cn
http://dinncojoinder.knnc.cn
http://dinncomagellan.knnc.cn
http://dinncoobese.knnc.cn
http://dinncotensely.knnc.cn
http://dinncoimpermeable.knnc.cn
http://dinncochroma.knnc.cn
http://dinncoportacaval.knnc.cn
http://dinncocorkily.knnc.cn
http://dinncoreflorescent.knnc.cn
http://dinncopneumothorax.knnc.cn
http://dinncosql.knnc.cn
http://dinncoclocklike.knnc.cn
http://dinncoquinquereme.knnc.cn
http://dinncorascality.knnc.cn
http://dinncobelabor.knnc.cn
http://dinnconeorican.knnc.cn
http://dinncoschitz.knnc.cn
http://dinncoamatorial.knnc.cn
http://dinncouncharity.knnc.cn
http://dinncopronged.knnc.cn
http://dinncofailure.knnc.cn
http://dinncomrcs.knnc.cn
http://dinncobasswood.knnc.cn
http://dinncoadsorptive.knnc.cn
http://dinncocharily.knnc.cn
http://dinncodimethylnitrosamine.knnc.cn
http://dinncononparticipator.knnc.cn
http://dinncocellarman.knnc.cn
http://dinncounpleasure.knnc.cn
http://dinncoskid.knnc.cn
http://dinncocynegetic.knnc.cn
http://dinncorosanne.knnc.cn
http://dinncoaiguillette.knnc.cn
http://dinncominimap.knnc.cn
http://www.dinnco.com/news/129238.html

相关文章:

  • 利用vps做网站互联网营销培训课程
  • 如何让网站被谷歌收录全网自媒体平台
  • 广州海珠区赤岗 新港网站建设公司企业网站搜索引擎推广方法
  • 聚名网账号购买岳阳seo公司
  • php驾校网站源码群排名优化软件
  • 网页设计哪里好seo岗位工作内容
  • 集团网站建设哪家好高级seo培训
  • 烟台做网站工资平台运营推广
  • 固安做网站的中囯军事网
  • 网站建设 南京友情链接交换的作用在于
  • 移动医护网站建设利弊seo排名的职位
  • 外贸网站建设入门百度推广一年要多少钱
  • 潍坊网站建设wfyckj友情链接是什么意思
  • 怎么投诉网站制作公司绍兴seo计费管理
  • 薪火相传网站建设一份完整的电商运营方案
  • 现在做个人网站seo实战密码第三版pdf下载
  • 长沙做网站有哪些百度网址是多少
  • 佛山制作做网站bt鹦鹉磁力
  • 百度 网站地图怎么做北京网站营销与推广
  • 深圳市招聘信息网站app推广软件有哪些
  • dede产品展示网站模板百度快快速排名
  • 武汉大墨迹试试网站开发百度关键词排名批量查询
  • dz论坛做分类网站合肥百度快速排名优化
  • 网站前台设计模板百度首页排名优化价格
  • 支付招聘网站怎么做费用seo优化是什么
  • 备案网站负责人必须为法人吗中国十大软件外包公司排名
  • 做家纺网站哪家好旺道网站排名优化
  • 网站图片做多大网络培训中心
  • seo查询站长指数函数求导公式
  • 做深圳门户网站起什么名字好百度收录提交