python手机连续点击脚本_Appium-Python 通过 find_element_by_android_uiautomator 后怎么连续点击两次...

本文探讨了使用Appium-Python在执行find_element_by_android_uiautomator后如何实现元素的连续两次点击。尽管代码显示执行了两次点击操作,但实际上仅点击了一次,且日志未报告错误。内容涉及到UI自动化测试和Appium的使用技巧。
摘要由CSDN通过智能技术生成

Appium-Python 通过find_element_by_android_uiautomator后怎么连续点击两次,比如self.driver.find_element_by_android_uiautomator('new UiSelector().text("1")').click(),self.driver.find_element_by_android_uiautomator('new UiSelector().text("1")').click()后实际只点击了一次,log里也没有报错信息,显示两次点击成功

[HTTP] --> POST /wd/hub/session/3a6276af-1374-4434-8986-1877fdab23b9/element

[HTTP] {"using":"-android uiautomator","sessionId":"3a6276af-1374-4434-8986-1877

fdab23b9","value":"new UiSelector().text(\"1\")"}

[debug] [W3C] Calling AppiumDriver.findElement() with args: ["-android uiautomat

or","new UiSelector().text(\"1\")","3a6276af-1374-4434-8986-1877fdab23b9"]

[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class

name, accessibility id, -android uiautomator

[debug] [BaseDriver] Waiting up to 0 ms for condition

[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8205/w

d/hub/session/d34a8178-0291-4d5d-9f2d-ba6082e480cf/element] with body: {"strateg

y":"-android uiautomator","selector":"new UiSelector().text(\"1\")","context":""

,"multiple":false}

[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d34a8178-0291

-4d5d-9f2d-ba6082e480cf","status":0,"value":{"ELEMENT":"7094742f-b379-4462-9ba2-

2c1e454f336d"}}

[debug] [W3C] Responding to client with driver.findElement() result: {"ELEMENT":

"7094742f-b379-4462-9ba2-2c1e454f336d"}

[HTTP]

67 ms - 122

[HTTP]

[HTTP] --> POST /wd/hub/session/3a6276af-1374-4434-8986-1877fdab23b9/element/709

4742f-b379-4462-9ba2-2c1e454f336d/click

[HTTP] {"sessionId":"3a6276af-1374-4434-8986-1877fdab23b9","id":"7094742f-b379-4

462-9ba2-2c1e454f336d"}

[debug] [W3C] Calling AppiumDriver.click() with args: ["7094742f-b379-4462-9ba2-

2c1e454f336d","3a6276af-1374-4434-8986-1877fdab23b9"]

[debug] [JSONWP Proxy] Proxying [POST /element/7094742f-b379-4462-9ba2-2c1e454f3

36d/click] to [POST http://localhost:8205/wd/hub/session/d34a8178-0291-4d5d-9f2d

-ba6082e480cf/element/7094742f-b379-4462-9ba2-2c1e454f336d/click] with body: {"e

lement":"7094742f-b379-4462-9ba2-2c1e454f336d"}

[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d34a8178-0291

-4d5d-9f2d-ba6082e480cf","status":0,"value":true}

[debug] [W3C] Responding to client with driver.click() result: true

[HTTP]

4742f-b379-4462-9ba2-2c1e454f336d/click 200 3139 ms - 76

[HTTP]

[HTTP] --> POST /wd/hub/session/3a6276af-1374-4434-8986-1877fdab23b9/element

[HTTP] {"using":"-android uiautomator","sessionId":"3a6276af-1374-4434-8986-1877

fdab23b9","value":"new UiSelector().text(\"1\")"}

[debug] [W3C] Calling AppiumDriver.findElement() with args: ["-android uiautomat

or","new UiSelector().text(\"1\")","3a6276af-1374-4434-8986-1877fdab23b9"]

[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class

name, accessibility id, -android uiautomator

[debug] [BaseDriver] Waiting up to 0 ms for condition

[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8205/w

d/hub/session/d34a8178-0291-4d5d-9f2d-ba6082e480cf/element] with body: {"strateg

y":"-android uiautomator","selector":"new UiSelector().text(\"1\")","context":""

,"multiple":false}

[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d34a8178-0291

-4d5d-9f2d-ba6082e480cf","status":0,"value":{"ELEMENT":"39c31733-3d13-4c05-93a8-

8e004d0cde41"}}

[debug] [W3C] Responding to client with driver.findElement() result: {"ELEMENT":

"39c31733-3d13-4c05-93a8-8e004d0cde41"}

[HTTP]

30 ms - 122

[HTTP]

[HTTP] --> POST /wd/hub/session/3a6276af-1374-4434-8986-1877fdab23b9/element/39c

31733-3d13-4c05-93a8-8e004d0cde41/click

[HTTP] {"sessionId":"3a6276af-1374-4434-8986-1877fdab23b9","id":"39c31733-3d13-4

c05-93a8-8e004d0cde41"}

[debug] [W3C] Calling AppiumDriver.click() with args: ["39c31733-3d13-4c05-93a8-

8e004d0cde41","3a6276af-1374-4434-8986-1877fdab23b9"]

[debug] [JSONWP Proxy] Proxying [POST /element/39c31733-3d13-4c05-93a8-8e004d0cd

e41/click] to [POST http://localhost:8205/wd/hub/session/d34a8178-0291-4d5d-9f2d

-ba6082e480cf/element/39c31733-3d13-4c05-93a8-8e004d0cde41/click] with body: {"e

lement":"39c31733-3d13-4c05-93a8-8e004d0cde41"}

[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d34a8178-0291

-4d5d-9f2d-ba6082e480cf","status":0,"value":true}

[debug] [W3C] Responding to client with driver.click() result: true

[HTTP]

31733-3d13-4c05-93a8-8e004d0cde41/click 200 3131 ms - 76

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Appium是一个用于自动化移动应用程序的工具,它支持多种编程语言,包括Python。在使用Appium Python脚本连接手机之前,我们首先需要安装Appium服务器和Appium Python客户端库。 首先,我们需要确保已安装Appium服务器,并启动该服务器。然后,在Python环境中安装Appium Python客户端库。可以使用pip工具来安装Appium Python客户端库: ```python pip install Appium-Python-Client ``` 接下来,我们创建一个Python脚本来连接手机,并执行一些操作。在脚本中,我们需要指定设备的一些参数,如设备名称、平台版本、应用包名等。然后,我们可以使用Appium提供的API来进行手机操作,如启动应用、查找元素、模拟手势等。 一个简单的Appium Python脚本连接手机的例子如下: ```python from appium import webdriver desired_caps = { 'platformName': 'Android', 'platformVersion': '9.0', 'deviceName': 'emulator-5554', 'appPackage': 'com.example.myapp', 'appActivity': '.MainActivity' } driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) # 执行一些操作 element = driver.find_element_by_id('com.example.myapp:id/button') element.click() # 关闭应用 driver.quit() ``` 以上代码示例中,我们使用了Appium提供的webdriver.Remote方法连接手机,并指定了设备参数。然后,我们找到了应用中的一个按钮元素,并点击了它。最后,我们使用quit方法关闭了应用。 通过编写Appium Python脚本,我们可以方便地连接手机,并实现自动化测试、应用操作等功能。同时,Appium提供了丰富的API和文档,可以帮助我们更好地进行移动应用自动化开发。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值