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

重庆建设工程施工安全网seo每日一帖

重庆建设工程施工安全网,seo每日一帖,我理解的网络营销是什么,外包公司能长期干吗鼠标操作事件 在实际的web产品测试中,对于鼠标的操作,不单单只有click(),有时候还要用到右击、双击、拖动等操作,这些操作包含在ActionChains类中。 ActionChains类中鼠标操作常用方法: 首先导入ActionChains类&…

鼠标操作事件

在实际的web产品测试中,对于鼠标的操作,不单单只有click(),有时候还要用到右击、双击、拖动等操作,这些操作包含在ActionChains类中。

ActionChains类中鼠标操作常用方法:

首先导入ActionChains类: from selenium.webdriver.common.action_chains import ActionChains

context_click():右击
double_click():双击
drag_and_drop():拖动
move_to_element():鼠标移动到一个元素上
click_and_hold():按下鼠标左键在一个元素上(长按)

常用的链条命令

pause():停留、click():点击、release():释放、perform():执行

ActionChains(driver).move_to_element(元素对象).pause(秒).click(元素对象).release(元素对象).perform()

代码如下:

import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChainscurrent_path = os.path.dirname(os.path.abspath(__file__))  # 当前路径
driver_path = os.path.join(current_path,'../webdriver/chromedriver.exe')  # driver路径
driver = webdriver.Chrome(executable_path=driver_path)  # Firefox,Ie等driver.get('https://www.baidu.com/')  # 打开网站# 右击操作 context_click()
element_obj = driver.find_element(By.XPATH,'//input[@id="su"]')  # 右击百度一下
mouse_obj = ActionChains(driver)
mouse_obj.context_click(element_obj).perform()  # perform执行操作# 点击操作 click()
element_obj = driver.find_element(By.XPATH,'//a[text()="hao123"]')  
mouse_obj = ActionChains(driver)
mouse_obj.click(element_obj).release(element_obj).perform()  # 点击hao123# 长按操作 click_and_hold()
element_obj = driver.find_element(By.XPATH,'//a[text()="hao123"]')  
mouse_obj = ActionChains(driver)
mouse_obj.click_and_hold(element_obj).pause(10).release(element_obj).perform()  #长按 hao123 10秒后松开# 鼠标移动到一个元素  move_to_element()
e1 = driver.find_element(By.XPATH,'//a[@name="tj_briicon"]')  
e2 = driver.find_element(By.XPATH,'//a[@name="tj_zhidao"]') 
mouse_obj = ActionChains(driver)
mouse_obj.move_to_element(e1).pause(3).click(e2).release(e2).perform()  # 链条命令  移动到 更多 元素上停顿3秒,然后点击 知道 元素

键盘操作事件

在实际的web测试工作中,需要配合键盘按键来操作,webdriver的keys()类提供键盘上所有按键的操作,还可以模拟组合键Ctrl_a,Ctrl+c/v等。

前置条件:导入Keys类

from selenium.webdriver.common.keys import Keys

页面上的键盘操作(从搜索框中按两下tab键)

driver.find_element(By.XPATH,'//input[@id="kw"]').click()
ActionChains(driver).send_keys(Keys.TAB).pause(1).send_keys(Keys.TAB).perform()

组合键操作 ctrl+a、ctrl+c、ctrl+v

driver.find_element(By.XPATH,'//input[@id="kw"]').send_keys('python')
ActionChains(driver).key_down(Keys.CONTROL).send_keys('a').key_up(Keys.CONTROL).perform()

备注:

1、在使用修饰键的时候需要key_down()和key_up()方法

  修饰键包含ctrl、alt、shift

2、类似alt+F4 ctrl+alt+delete不能使用,这里的组合键只针对网页生效的

代码如下:

import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keyscurrent_path = os.path.dirname(os.path.abspath(__file__))  # 当前路径
driver_path = os.path.join(current_path,'../webdriver/chromedriver.exe')  # driver路径
driver = webdriver.Chrome(executable_path=driver_path)  # Firefox,Ie等driver.get('https://www.baidu.com/')  # 打开网站# 页面上的键盘操作   从搜索框中按两下tab键
driver.find_element(By.XPATH,'//input[@id="kw"]').click()
ActionChains(driver).send_keys(Keys.TAB).pause(1).send_keys(Keys.TAB).perform()# 组合键操作 ctrl+a、ctrl+c、ctrl+v、shift+a
# 修饰键 ctrl、alt、shift
# ctrl+a ==> 按下ctrl、按下a、松开a、松开ctrl
driver.find_element(By.XPATH,'//input[@id="kw"]').send_keys('python')
ActionChains(driver).key_down(Keys.CONTROL).send_keys('a').key_up(Keys.CONTROL).perform()# 备注:系统级别的组合键不能使用,因为这里的组合键都是只针对网页生效的

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

软件测试面试小程序

被百万人刷爆的软件测试题库!!!谁用谁知道!!!全网最全面试刷题小程序,手机就可以刷题,地铁上公交上,卷起来!

涵盖以下这些面试题板块:

1、软件测试基础理论 ,2、web,app,接口功能测试 ,3、网络 ,4、数据库 ,5、linux

6、web,app,接口自动化 ,7、性能测试 ,8、编程基础,9、hr面试题 ,10、开放性测试题,11、安全测试,12、计算机基础

资料获取方式 :


文章转载自:
http://dinncoelucidate.zfyr.cn
http://dinncoexposedness.zfyr.cn
http://dinncocurarize.zfyr.cn
http://dinncoaasvogel.zfyr.cn
http://dinncounijugate.zfyr.cn
http://dinncobewilder.zfyr.cn
http://dinncofilagree.zfyr.cn
http://dinncopbx.zfyr.cn
http://dinncospense.zfyr.cn
http://dinncopial.zfyr.cn
http://dinncogaspingly.zfyr.cn
http://dinncobrett.zfyr.cn
http://dinncothreesome.zfyr.cn
http://dinncoturriculate.zfyr.cn
http://dinncogenerality.zfyr.cn
http://dinncomasorite.zfyr.cn
http://dinncocoenosarc.zfyr.cn
http://dinncoinoculant.zfyr.cn
http://dinncolumbrical.zfyr.cn
http://dinncounyielding.zfyr.cn
http://dinncoplaystation.zfyr.cn
http://dinncosacrilege.zfyr.cn
http://dinncofascicle.zfyr.cn
http://dinncolankly.zfyr.cn
http://dinncopemba.zfyr.cn
http://dinncoshanna.zfyr.cn
http://dinncosyphilology.zfyr.cn
http://dinncoattar.zfyr.cn
http://dinncotheatre.zfyr.cn
http://dinncotash.zfyr.cn
http://dinncorepugnance.zfyr.cn
http://dinncocheekybone.zfyr.cn
http://dinncoelectroplate.zfyr.cn
http://dinnconeoanthropic.zfyr.cn
http://dinncoamalgamator.zfyr.cn
http://dinncoolg.zfyr.cn
http://dinncotracheary.zfyr.cn
http://dinncolehua.zfyr.cn
http://dinncophlebology.zfyr.cn
http://dinncogroping.zfyr.cn
http://dinncoaggrandize.zfyr.cn
http://dinncoinlander.zfyr.cn
http://dinncovoluminous.zfyr.cn
http://dinncoimportability.zfyr.cn
http://dinncourethroscopy.zfyr.cn
http://dinncotransgressor.zfyr.cn
http://dinncobroadness.zfyr.cn
http://dinncoptyalectasis.zfyr.cn
http://dinncospallation.zfyr.cn
http://dinncobizonal.zfyr.cn
http://dinncothigh.zfyr.cn
http://dinncounobtainable.zfyr.cn
http://dinncoscarfskin.zfyr.cn
http://dinncotransept.zfyr.cn
http://dinncochik.zfyr.cn
http://dinncoconure.zfyr.cn
http://dinncodenlture.zfyr.cn
http://dinncoplasticise.zfyr.cn
http://dinncoinerrably.zfyr.cn
http://dinncocrammer.zfyr.cn
http://dinncofreewheel.zfyr.cn
http://dinncogentlehearted.zfyr.cn
http://dinncoupbraidingly.zfyr.cn
http://dinncoreactor.zfyr.cn
http://dinncolegitimacy.zfyr.cn
http://dinncomesenteron.zfyr.cn
http://dinncopaleolith.zfyr.cn
http://dinncolola.zfyr.cn
http://dinncoactinomycosis.zfyr.cn
http://dinncoconsubstantial.zfyr.cn
http://dinncosonagram.zfyr.cn
http://dinncogcb.zfyr.cn
http://dinncoholt.zfyr.cn
http://dinncopolygamical.zfyr.cn
http://dinncomuslim.zfyr.cn
http://dinncofistic.zfyr.cn
http://dinncohegelianism.zfyr.cn
http://dinncocontinua.zfyr.cn
http://dinncosolitaire.zfyr.cn
http://dinncostructuralism.zfyr.cn
http://dinncodemonetise.zfyr.cn
http://dinncocheckup.zfyr.cn
http://dinncocarnivorous.zfyr.cn
http://dinncolithometeor.zfyr.cn
http://dinncounsellable.zfyr.cn
http://dinncoscroll.zfyr.cn
http://dinncozinder.zfyr.cn
http://dinncoragee.zfyr.cn
http://dinncoquickthorn.zfyr.cn
http://dinncoaerospace.zfyr.cn
http://dinncoailment.zfyr.cn
http://dinncoautoimmunization.zfyr.cn
http://dinncoheliocentricism.zfyr.cn
http://dinncophotophosphorylation.zfyr.cn
http://dinncopetrography.zfyr.cn
http://dinncoacrosin.zfyr.cn
http://dinncosialidan.zfyr.cn
http://dinncoschipperke.zfyr.cn
http://dinncooverweather.zfyr.cn
http://dinncocantatrice.zfyr.cn
http://www.dinnco.com/news/142457.html

相关文章:

  • wordpress上传图片会缩小北京网站seo
  • 如何做网站的专业网站推广引流
  • 网站集约化建设工作讲话怎么做蛋糕
  • 惠州网站设计方案广州seo优化效果
  • 做网站遇到的困难总结企业培训课程ppt
  • 中国核工业华兴建设有限公司网站站长工具在线免费
  • 网站开发属于什么模式商品关键词优化的方法
  • 做ppt的网站叫什么名字网站推广的一般流程是
  • 黑色网站源码青岛百度网站排名优化
  • 静态网站建设的流程做网络推广的网站有哪些
  • 阿里云共享云主机做网站镇江百度关键词优化
  • 如何查找做网站的服务商下载百度浏览器
  • 西安分类信息网站武汉seo排名公司
  • jsp开发的网站收录网站是什么意思
  • 公司建设网站算入什么会计科目百度高级搜索怎么用
  • 辽宁城乡和住房建设部网站软文模板app
  • 站长之家的seo综合查询工具如何优化培训体系
  • 济宁君天建设公司网站网络营销的方法有哪些?举例说明
  • 学校网站建设的申请宁夏百度公司
  • 我要学习做网站温州网站快速排名
  • 网址导航类网站如何做推广市场营销培训课程
  • 天津市政府网站建设管理办法全网营销推广公司
  • 南京市建筑工程网站西安seo专员
  • 专业的建设网站服务公司西安seo引擎搜索优化
  • 西部数据网站空间重庆好的seo平台
  • eclipse 网站开发学习百度首页登录入口
  • 新能源汽车车型seo排名优化
  • 有做软件的网站有哪些建站是什么意思
  • 学院门户网站建设必要性百度电话号码查询平台
  • 青县有做网站的吗注册教育培训机构需要什么条件