android python,android 訪問web.py,Appium 測試 Android 時,python 用例調用 Webdriver.remote

 2023-10-06 阅读 31 评论 0

摘要:大家好!遇到一個問題,希望大家能指點一下。我搭建好了 Appium 測試 Android 應用的測試環境,在運行 Python 編寫的測試用例時,發現調用 Webdriver.remote 后,沒有任何回應,Appium 的 log 如下:android python?info: Welcom

大家好!遇到一個問題,希望大家能指點一下。我搭建好了 Appium 測試 Android 應用的測試環境,在運行 Python 編寫的測試用例時,發現調用 Webdriver.remote 后,沒有任何回應,Appium 的 log 如下:

android python?info: Welcome to Appium v0.15.0 (REV a7b47d73a27074cc928cc5b325e5d4de1b6e5594)

info: Appium REST http interface listener started on 127.0.0.1:4723

info - socket.io started

debug: Appium request initiated at /wd/hub/session

debug: Request received with params: {"sessionId":null,"desiredCapabilities":{"a

pp-package":"lana.test.hellolana","app":"F:\workspace\HelloLana\bin\HelloLan

a.apk","browserName":"","version":"4.2","device":"Android","app-activity":"lana.

test.hellolana.HelloLanaActivity"}}

info: Using local app from desiredCaps: F:\workspace\HelloLana\bin\HelloLana.apk

info: Creating new appium session 93723c5f-066c-4923-9536-ab582746d37d

info: Starting android appium

debug: Using fast reset? false

info: Preparing device for session

info: Checking whether app is actually present

info: Checking whether adb is present

然后過了十幾分鐘后,Appium 的 log 打印出:POST /wd/hub/session 200 600810ms

測試用例代碼拋出如下異常:

Traceback (most recent call last):

File "F:\Appium\sample-code\examples\python\android_lana0319.py", line 22, in

driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 71, in init

self.start_session(desired_capabilities, browser_profile)

File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 113, in start_session

'desiredCapabilities': desired_capabilities,

File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 162, in execute

response = self.command_executor.execute(driver_command, params)

File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 349, in execute

return self._request(command_info[0], url, body=data)

File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 417, in _request

resp = opener.open(request)

File "C:\Python27\lib\urllib2.py", line 394, in open

response = self._open(req, data)

File "C:\Python27\lib\urllib2.py", line 412, in _open

'_open', req)

File "C:\Python27\lib\urllib2.py", line 372, in _call_chain

result = func(*args)

File "C:\Python27\lib\urllib2.py", line 1199, in http_open

return self.do_open(httplib.HTTPConnection, req)

File "C:\Python27\lib\urllib2.py", line 1170, in do_open

r = h.getresponse(buffering=True)

File "C:\Python27\lib\httplib.py", line 1027, in getresponse

response.begin()

File "C:\Python27\lib\httplib.py", line 407, in begin

version, status, reason = self._read_status()

File "C:\Python27\lib\httplib.py", line 371, in _read_status

raise BadStatusLine(line)

BadStatusLine: ''

環境配置和代碼參數都多次檢查過了,但是始終沒有找到問題原因。希望大家能幫忙看看,萬分謝謝!

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/5/122305.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息