Selenium 2.5 无法在 Android 上使用 driver.get

发布于 2024-12-03 13:43:11 字数 1290 浏览 1 评论 0原文

我在 iOS 上一切运行良好,并且正在尝试启动并运行 Android Web 测试。我正在用 Python 2.7.2 编写测试。
当我尝试以下代码时出现异常:

from selenium import webdriver
driver = webdriver.Remote(desired_capabilities="ANDROID", command_executor='http://localhost:8080/wd/hub')
driver.get('http://www.google.com')


我在 driver.get 命令中遇到异常。但同样的命令也适用于 iOS。 Android 有不同的实现吗?

例外:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 154, in get
    self.execute(Command.GET, {'url': url})
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 144, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/errorhandler.py", line 118, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: None ; Stacktrace: Method handle threw an error in WebDriverHandler.java

I have everything running well on iOS, and am trying to get up and running with Android web testing. I am writing the tests in Python 2.7.2.

I get an exception when I try the below code:

from selenium import webdriver
driver = webdriver.Remote(desired_capabilities="ANDROID", command_executor='http://localhost:8080/wd/hub')
driver.get('http://www.google.com')

I get an exception with the driver.get command. But the same command works on iOS. Is there a different implementation for Android?

Exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 154, in get
    self.execute(Command.GET, {'url': url})
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 144, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/errorhandler.py", line 118, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: None ; Stacktrace: Method handle threw an error in WebDriverHandler.java

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文