python 输入框拖动随意摆放_python selenium5 模拟点击+拖动+按照指定相对坐标拖动 58同城验证码...

#!/usr/bin/python#-*- coding: UTF-8 -*-#@Time : 2019年12月9日11:41:08#@Author : shenghao/10347899@qq.com'''test with selenium's move by x,y'''from builtins import printfrom selenium importwebdriverfr...
摘要由CSDN通过智能技术生成

#!/usr/bin/python#-*- coding: UTF-8 -*-#@Time : 2019年12月9日11:41:08#@Author : shenghao/10347899@qq.com

'''test with selenium's move by x,y'''

from builtins import print

from selenium importwebdriverfrom selenium.webdriver.support.ui importWebDriverWaitfrom selenium.webdriver.support importexpected_conditions as ECfrom selenium.webdriver.common.by importByimportcv2 as cvimporttime, datetime, random,shutilfrom selenium.webdriver.common.action_chains importActionChainsfrom selenium.webdriver.common.touch_actions importTouchActionsfrom selenium.webdriver.common.keys importKeysfrom PIL importImageimportrequestsfrom io importBytesIOimportcv2, time, sys,reimportmatplotlib.pyplot as pltimportnumpy as npclassselenium(object):def __init__(self):

self.headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.8

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Selenium Grid中,可以使用Python编写测试用例并将其分发到多台计算机上运行。下面是一些基本步骤: 1. 安装Selenium Grid并启动Hub和至少一个Node(在不同的计算机上)。 2. 在测试用例中,使用Selenium WebDriver创建一个Remote WebDriver对象并指定Hub的地址和浏览器的配置。 ```python from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities # Specify the Hub URL and the browser configuration hub_url = "http://<hub-ip>:4444/wd/hub" capabilities = DesiredCapabilities.CHROME.copy() capabilities['platform'] = "WINDOWS" capabilities['version'] = "latest" # Create a Remote WebDriver object driver = webdriver.Remote(command_executor=hub_url, desired_capabilities=capabilities) ``` 3. 运行测试用例并观察它们在不同的节点上运行。 ```python driver.get("http://www.google.com") print(driver.title) ``` 4. 将测试用例分配到不同的节点上,以便并行执行测试。 ```python # Specify the node URL and the browser configuration node_url = "http://<node-ip>:5555/wd/hub" capabilities = DesiredCapabilities.CHROME.copy() capabilities['platform'] = "LINUX" capabilities['version'] = "latest" # Create a Remote WebDriver object for the node node_driver = webdriver.Remote(command_executor=node_url, desired_capabilities=capabilities) # Run the tests on the node node_driver.get("http://www.google.com") print(node_driver.title) ``` 这样,您就可以使用Python编写测试用例并将它们分发到多台计算机上运行,以加快测试速度。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值