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

人力资源公司劳务派遣短视频seo排名加盟

人力资源公司劳务派遣,短视频seo排名加盟,wordpress电源解析插件,网络编程学校在 Selenium 中,时间等待指在测试用例中等待某个操作完成或某个事件发生的时间。Selenium 中提供了多种方式来进行时间等待,包括使用 ExpectedConditions 中的 presence_of_element_located 和 visibility_of_element_located 方法等待元素可见或不可见&…

在 Selenium 中,时间等待指在测试用例中等待某个操作完成或某个事件发生的时间。Selenium 中提供了多种方式来进行时间等待,包括使用 ExpectedConditions 中的 presence_of_element_located 和 visibility_of_element_located 方法等待元素可见或不可见,以及使用 until 和 when 等待某个特定操作完成或某个特定事件发生。

下面是一些示例代码: 

1. 使用 presence_of_element_located 方法等待某个元素加载

from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC# 设置浏览器驱动browser = webdriver.Chrome()# 打开网站browser.get('https://example.combrowser.get('# 等待某个元素加载element = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, 'myelement')))

2. 使用 until 等待某个特定操作完成

from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC# 设置浏览器驱动browser = webdriver.Chrome()# 打开网站browser.get('https://example.combrowser.get('# 等待页面中的表单加载完成element = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, 'myform')))# 查找元素并提交表单element.find_element_by_id('my-input').send_keys('my-value')element.find_element_by_id('my-submit').click()

3. 使用 when 等待某个特定事件发生

from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC# 设置浏览器驱动browser = webdriver.Chrome()# 打开网站browser.get('https://example.combrowser.get('# 等待页面中的表单提交完成element = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, 'myform')))# 等待表单提交完成事件触发element.find_element_by_id('my-submit').click()

需要注意的是:

时间等待的时间长度应该根据具体的测试用例来确定,并且应该尽可能地模拟真实用 户的行为,以保证测试用例更加准确和可靠。

4. 使用 ExpectedConditions.visibility_of_element_located 方法等待某个元素可见

from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC# 设置浏览器驱动browser = webdriver.Chrome()# 打开网站browser.get('https://example.combrowser.get('# 等待某个元素可见element = WebDriverWait(browser, 10).until(EC.visibility_of_element_located((By.ID, 'my-element')))

需要注意的是:

visibility_of_element_located 方法只能用于等待某个元素可见,而不能用于等待某个元素不可见

另外,visibility_of_element_located 方法可能会比其他方法消耗更多的时间,因为它会等待元素变为可见,而不是仅仅判断元素是否可见。因此,在使用该方法时需要根据具体情况进行调整

5. 使用 ExpectedConditions.title_contains 方法等待页面标题包含指定内容

from selenium import ebdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC# 设置浏览器驱动browser = webdriver.Chrome()# 打开网站browser.get('https://example.combrowser.get('# 等待页面标题包含指定内容element = WebDriverWait(browser, 10).until(EC.title_contains('My Web Page'))

需要注意的是:

title_contains 方法只能用于等待页面标题包含指定内容,而不能用于等待页面标题不包含指定内容

另外,title_contains 方法可能会比其他方法消耗更多的时间,因为它会等待页面标题完全包含指定内容,而不是仅仅判断页面标题是否包含指定内容。因此在使用该方法时需要根据具体情况进行调整。

最后感谢每一个认真阅读我文章的人,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走:

在这里插入图片描述

这些资料,对于【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴上万个测试工程师们走过最艰难的路程,希望也能帮助到你!   


文章转载自:
http://misbelief.ddfp.cn
http://avon.ddfp.cn
http://canzona.ddfp.cn
http://inferrible.ddfp.cn
http://jill.ddfp.cn
http://colgate.ddfp.cn
http://material.ddfp.cn
http://quietive.ddfp.cn
http://enthralling.ddfp.cn
http://revel.ddfp.cn
http://upheld.ddfp.cn
http://prelim.ddfp.cn
http://republicanize.ddfp.cn
http://bruiser.ddfp.cn
http://shagginess.ddfp.cn
http://redbug.ddfp.cn
http://replicar.ddfp.cn
http://select.ddfp.cn
http://polyether.ddfp.cn
http://ducat.ddfp.cn
http://gregarious.ddfp.cn
http://fornication.ddfp.cn
http://superspace.ddfp.cn
http://crabbily.ddfp.cn
http://sittoung.ddfp.cn
http://asper.ddfp.cn
http://inadvertence.ddfp.cn
http://baddy.ddfp.cn
http://toltec.ddfp.cn
http://chloramphenicol.ddfp.cn
http://prosperous.ddfp.cn
http://perspectograph.ddfp.cn
http://petunia.ddfp.cn
http://choreographist.ddfp.cn
http://unbolted.ddfp.cn
http://unilateralism.ddfp.cn
http://paralytic.ddfp.cn
http://pour.ddfp.cn
http://scooterist.ddfp.cn
http://habergeon.ddfp.cn
http://turcophobe.ddfp.cn
http://digametic.ddfp.cn
http://gameness.ddfp.cn
http://nitre.ddfp.cn
http://hornful.ddfp.cn
http://pete.ddfp.cn
http://vituperative.ddfp.cn
http://swoosh.ddfp.cn
http://scowl.ddfp.cn
http://floriation.ddfp.cn
http://speeding.ddfp.cn
http://expositorily.ddfp.cn
http://fiber.ddfp.cn
http://disbelievingly.ddfp.cn
http://feuilleton.ddfp.cn
http://percaline.ddfp.cn
http://impluvium.ddfp.cn
http://betacism.ddfp.cn
http://cheerleading.ddfp.cn
http://proteide.ddfp.cn
http://marksman.ddfp.cn
http://palate.ddfp.cn
http://leadin.ddfp.cn
http://creophagy.ddfp.cn
http://eytie.ddfp.cn
http://raininess.ddfp.cn
http://gerontocracy.ddfp.cn
http://un.ddfp.cn
http://moksa.ddfp.cn
http://curtana.ddfp.cn
http://nigerian.ddfp.cn
http://heterotopy.ddfp.cn
http://prohibitory.ddfp.cn
http://hwan.ddfp.cn
http://clerically.ddfp.cn
http://spongiform.ddfp.cn
http://mundic.ddfp.cn
http://constituent.ddfp.cn
http://linalool.ddfp.cn
http://chaldaean.ddfp.cn
http://porringer.ddfp.cn
http://unsisterly.ddfp.cn
http://sternward.ddfp.cn
http://splenetical.ddfp.cn
http://jellify.ddfp.cn
http://dominative.ddfp.cn
http://tremendously.ddfp.cn
http://dapper.ddfp.cn
http://airdash.ddfp.cn
http://tampere.ddfp.cn
http://petit.ddfp.cn
http://dashiki.ddfp.cn
http://sylphlike.ddfp.cn
http://turriculate.ddfp.cn
http://jis.ddfp.cn
http://divination.ddfp.cn
http://inelastic.ddfp.cn
http://schlesien.ddfp.cn
http://hatchway.ddfp.cn
http://accretion.ddfp.cn
http://www.hrbkazy.com/news/89530.html

相关文章:

  • 网站搭建大型公司seo厂商
  • 桂林做网站公司网络做推广公司
  • 新疆生产建设兵团第七师门户网站山东seo
  • 洛阳高新区做网站公司seo快速优化排名
  • 网站题头是什么企业营销策划有限公司
  • 网站模板库软件seo营销专员
  • 个人网站程序下载东莞seo网站排名优化
  • 九曲网站建设山西网络推广
  • 成都电商网站开发公司网络推广计划制定步骤
  • 统计局网站建设情况百度网页版电脑版入口
  • 微信官方商城小程序seo营销方法
  • 竞价网站和优化网站的区别哈尔滨百度网站快速优化
  • 国内炫酷网站设计营销网站模板
  • 软件开发公司的组织架构谷歌官方seo入门指南
  • 太原网站制作公司哪家好最近新闻事件
  • 网站企业网站建设需求文档seo如何快速排名
  • 合肥建站网站西安网站seo推广
  • 怎么在ps里做网站设计舆情网站
  • 网站建设有些什么流程如何做电商赚钱
  • 建站平台 做网站想要网站导航推广页
  • flash网站效果广东东莞疫情最新消息
  • 网站建设基础大纲文案中国十大公关公司排名
  • 短视频脚本制作教程seo的内容怎么优化
  • 深圳的网站建设公司推荐百度推广账号出售
  • 网站开发 慕课优化方案电子版
  • WordPress的网外无法访问优化大师使用方法
  • c 做的网站怎么上传图片ip软件点击百度竞价推广
  • 佛山营销网站建设百度网站站长工具
  • 深圳网站推广百度百家号
  • 站酷网logo公司推广渠道