In my Python script I am trying to set some phone settings through Marionette driver. I am importing the following:
from marionette_driver import By
from marionette_driver import Wait
from marionette import Marionette
Then I am attempting to open a client session with the device:
client = Marionette('localhost', port=2828)
client.start_session()
However, I am receiving 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
FYI, I am using marionette-driver 1.1.1
Any suggestion regarding resolving this issue will be much appreciated.
Edit on 10/26/2018
It is returning a different error message now:
$ 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
This is probably due to an outdated driver as answered here: WebDriver Error New Session
If it is not Repo relate then it could be because .pyc files linger and python tries to use them first before recompiling.
Thank you. Good day.