在我的 Python 脚本中,我试图通过 Marionette 驱动程序设置一些电话设置。我正在导入以下内容:
from marionette_driver import By
from marionette_driver import Wait
from marionette import Marionette
然后我试图打开与设备的客户端会话:
client = Marionette('localhost', port=2828)
client.start_session()
但是,我收到 UnknownCommandException:
Traceback (most recent call last):
File "xyz.py", line 30, in <module>
client.start_session()
File "/usr/local/lib/python2.7/dist-packages/marionette_driver/decorators.py", line 26, in _
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/marionette_driver/marionette.py", line 1243, in start_session
body)
File "/usr/local/lib/python2.7/dist-packages/marionette_driver/decorators.py", line 26, in _
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/marionette_driver/marionette.py", line 741, in _send_message
self._handle_error(err)
File "/usr/local/lib/python2.7/dist-packages/marionette_driver/marionette.py", line 765, in _handle_error
raise errors.lookup(error)(message, stacktrace=stacktrace)
marionette_driver.errors.UnknownCommandException: WebDriver:NewSession
仅供参考,我正在使用 marionette-driver 1.1.1
任何有关解决此问题的建议将不胜感激。
2018 年 10 月 26 日编辑
它现在返回一条不同的错误消息:
$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from marionette import Marionette
Traceback (most recent call last):
File "./xyz.py", line 7, in <module>
from marionette import Marionette
File "/usr/local/lib/python2.7/dist-packages/marionette/__init__.py", line 7, in <module>
from .marionette_test import (
ImportError: No module named marionette_test