Closed davidemoro closed 7 years ago
Yes, please switch from selenium==3.4.1 to 3.3.1
Hi @elgalu,
thanks but now I get a different error:
$ tox --recreate -epy36 -- --splinter-webdriver=remote --variables=credentials/credentials-DEV-pcmw.yml --splinter-remote-url=http://localhost:4444/wd/hub/ -m login -k skin1 --variables capabilities/browsers/firefox/FIREFOX.json
GLOB sdist-make: /home/davide/workspaces/pcm2_qa/setup.py
py36 recreate: /home/davide/workspaces/pcm2_qa/.tox/py36
py36 installdeps: -rrequirements.txt, -e.
py36 inst: /home/davide/workspaces/pcm2_qa/.tox/dist/pcm2_qa-0.0.1.dev0.zip
py36 installed: alabaster==0.7.10,apipkg==1.4,appdirs==1.4.3,Babel==2.4.0,colander==1.3.3,configparser==3.5.0,coverage==4.4b1,docutils==0.13.1,enum34==1.1.6,execnet==1.4.1,funcsigs==1.0.2,glob2==0.5,imagesize==0.7.1,iso8601==0.1.11,Jinja2==2.9.6,Mako==1.0.6,MarkupSafe==1.0,mock==2.0.0,packaging==16.8,parse==1.8.0,parse-type==0.3.4,pbr==3.0.0,-e git+ssh://git@bitbucket.tierraservice.com:7999/test/pcm2-qa.git@5c1b5de3b07a2917962e3fc318c850552a48ecfe#egg=pcm2_qa,pkg-resources==0.0.0,pluggy==0.4.0,py==1.4.33,Pygments==2.2.0,pyparsing==2.2.0,PyPOM==1.1.1,pypom-form==0.2.2,pytest==3.0.7,pytest-bdd==2.18.1,pytest-cov==2.4.0,pytest-html==1.14.2,pytest-metadata==1.3.0,pytest-pypom-navigation==0.0.1,pytest-splinter==1.8.1,pytest-testrail==0.0.11,pytest-travis-fold==1.2.0,pytest-variables==1.7.0,pytest-xdist==1.16.0,pytz==2017.2,PyYAML==3.12,requests==2.11.1,selenium==3.3.1,simplejson==3.10.0,six==1.10.0,snowballstemmer==1.2.1,Sphinx==1.5.5,sphinx-rtd-theme==0.2.4,splinter==0.7.5,tox==2.7.0,translationstring==1.3,virtualenv==15.1.0,zope.component==4.3.0,zope.dottedname==4.2,zope.event==4.2.0,zope.interface==4.4.0
py36 runtests: PYTHONHASHSEED='3007056422'
py36 runtests: commands[0] | py.test --splinter-webdriver=remote --variables=credentials/credentials-DEV-pcmw.yml --splinter-remote-url=http://localhost:4444/wd/hub/ -m login -k skin1 --variables capabilities/browsers/firefox/FIREFOX.json
============================================================================================================================= test session starts =============================================================================================================================
platform linux -- Python 3.6.1, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 -- /home/davide/workspaces/pcm2_qa/.tox/py36/bin/python3.6
cachedir: .cache
metadata: {'Python': '3.6.1', 'Platform': 'Linux-4.10.0-33-generic-x86_64-with-Ubuntu-17.04-zesty', 'Packages': {'pytest': '3.0.7', 'py': '1.4.33', 'pluggy': '0.4.0'}, 'Plugins': {'xdist': '1.16.0', 'variables': '1.7.0', 'travis-fold': '1.2.0', 'testrail': '0.0.11', 'splinter': '1.8.1', 'pypom-navigation': '0.0.1', 'metadata': '1.3.0', 'html': '1.14.2', 'cov': '2.4.0', 'bdd': '2.18.1'}}
rootdir: /home/davide/workspaces/pcm2_qa, inifile: setup.cfg
plugins: xdist-1.16.0, variables-1.7.0, travis-fold-1.2.0, testrail-0.0.11, splinter-1.8.1, pypom-navigation-0.0.1, metadata-1.3.0, html-1.14.2, cov-2.4.0, bdd-2.18.1
collected 332 items
pcm2_qa/tests/functional/test_login.py::test_successfull_login[skin1] FAILED
------------------------------------------------------------------------------------------------------ generated html file: /home/davide/workspaces/pcm2_qa/report.html -------------------------------------------------------------------------------------------------------
================================================================================================================================== FAILURES ===================================================================================================================================
________________________________________________________________________________________________________________________ test_successfull_login[skin1] ________________________________________________________________________________________________________________________
splinter_webdriver = 'remote', retry_count = 3
def get_browser(splinter_webdriver, retry_count=3):
kwargs = get_args(driver=splinter_webdriver,
download_dir=splinter_file_download_dir,
download_ftypes=splinter_download_file_types,
firefox_pref=splinter_firefox_profile_preferences,
firefox_prof_dir=splinter_firefox_profile_directory,
remote_url=splinter_remote_url,
executable=splinter_webdriver_executable,
driver_kwargs=splinter_driver_kwargs)
try:
return splinter_browser_class(
splinter_webdriver, visit_condition=splinter_browser_load_condition,
visit_condition_timeout=splinter_browser_load_timeout,
> wait_time=splinter_wait_time, **kwargs
)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:485:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ('remote',), kwargs = {'browser': 'Firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm1hcmtlcgMAUEsDBBQAAAAIAEWMJUvXGbK...AAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'keep_alive': True, 'url': 'http://localhost:4444/wd/hub/', ...}
visit_condition = <function splinter_browser_load_condition.<locals>.<lambda> at 0x7f2063cbe950>, visit_condition_timeout = 10
def Browser(*args, **kwargs):
"""Emulate splinter's Browser."""
visit_condition = kwargs.pop('visit_condition')
visit_condition_timeout = kwargs.pop('visit_condition_timeout')
> browser = splinter.Browser(*args, **kwargs)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
driver_name = 'remote', args = ()
kwargs = {'browser': 'Firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm1hcmtlcgMAUEsDBBQAAAAIAEWMJUvXGbK...AAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'keep_alive': True, 'url': 'http://localhost:4444/wd/hub/', ...}
driver = <class 'splinter.driver.webdriver.remote.WebDriver'>
def Browser(driver_name='firefox', *args, **kwargs):
"""
Returns a driver instance for the given name.
When working with ``firefox``, it's possible to provide a profile name
and a list of extensions.
If you don't provide any driver_name, then ``firefox`` will be used.
If there is no driver registered with the provided ``driver_name``, this
function will raise a :class:`splinter.exceptions.DriverNotFoundError`
exception.
"""
try:
driver = _DRIVERS[driver_name]
except KeyError:
raise DriverNotFoundError("No driver for %s" % driver_name)
> return driver(*args, **kwargs)
.tox/py36/lib/python3.6/site-packages/splinter/browser.py:63:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <splinter.driver.webdriver.remote.WebDriver object at 0x7f2062440c50>, url = 'http://localhost:4444/wd/hub/', browser = 'Firefox', wait_time = 5
ability_args = {'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm1hcmtlcgMAUEsDBBQAAAAIAEWMJUvXGbKmkQYAAHkYAAAHAAAAdXNlc...UAxQAAAAIAEWMJUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'keep_alive': True}
browsername = 'FIREFOX'
abilities = {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm...MJUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}
def __init__(self, url=DEFAULT_URL, browser='firefox', wait_time=2, **ability_args):
browsername = browser.upper()
# Handle case where user specifies IE with a space in it
if browsername == 'INTERNET EXPLORER':
browsername = 'INTERNETEXPLORER'
abilities = getattr(DesiredCapabilities, browsername, {})
abilities.update(ability_args)
> self.driver = Remote(url, abilities)
.tox/py36/lib/python3.6/site-packages/splinter/driver/webdriver/remote.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>
args = ('http://localhost:4444/wd/hub/', {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQA...JUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...})
kwargs = {'keep_alive': True}
def __init__(self, *args, **kwargs):
"""Set keep_alive to True."""
kwargs['keep_alive'] = True
> return old_init(self, *args, **kwargs)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/webdriver_patches.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>, command_executor = 'http://localhost:4444/wd/hub/'
desired_capabilities = {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm...MJUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}
browser_profile = None, proxy = None, keep_alive = True, file_detector = None
def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=None, browser_profile=None, proxy=None,
keep_alive=False, file_detector=None):
"""
Create a new driver that will issue commands using the wire protocol.
:Args:
- command_executor - Either a string representing URL of the remote server or a custom
remote_connection.RemoteConnection object. Defaults to 'http://127.0.0.1:4444/wd/hub'.
- desired_capabilities - A dictionary of capabilities to request when
starting the browser session. Required parameter.
- browser_profile - A selenium.webdriver.firefox.firefox_profile.FirefoxProfile object.
Only used if Firefox is requested. Optional.
- proxy - A selenium.webdriver.common.proxy.Proxy object. The browser session will
be started with given proxy settings, if possible. Optional.
- keep_alive - Whether to configure remote_connection.RemoteConnection to use
HTTP keep-alive. Defaults to False.
- file_detector - Pass custom file detector object during instantiation. If None,
then default LocalFileDetector() will be used.
"""
if desired_capabilities is None:
raise WebDriverException("Desired Capabilities can't be None")
if not isinstance(desired_capabilities, dict):
raise WebDriverException("Desired Capabilities must be a dictionary")
if proxy is not None:
proxy.add_to_capabilities(desired_capabilities)
self.command_executor = command_executor
if type(self.command_executor) is bytes or isinstance(self.command_executor, str):
self.command_executor = RemoteConnection(command_executor, keep_alive=keep_alive)
self._is_remote = True
self.session_id = None
self.capabilities = {}
self.error_handler = ErrorHandler()
self.start_client()
> self.start_session(desired_capabilities, browser_profile)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>
desired_capabilities = {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm...MJUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}
browser_profile = None
def start_session(self, desired_capabilities, browser_profile=None):
"""
Creates a new session with the desired capabilities.
:Args:
- browser_name - The name of the browser to request.
- version - Which browser version to request.
- platform - Which platform to request the browser on.
- javascript_enabled - Whether the new session should support JavaScript.
- browser_profile - A selenium.webdriver.firefox.firefox_profile.FirefoxProfile object. Only used if Firefox is requested.
"""
capabilities = {'desiredCapabilities': {}, 'requiredCapabilities': {}}
for k, v in desired_capabilities.items():
if k not in ('desiredCapabilities', 'requiredCapabilities'):
capabilities['desiredCapabilities'][k] = v
else:
capabilities[k].update(v)
if browser_profile:
capabilities['desiredCapabilities']['firefox_profile'] = browser_profile.encoded
> response = self.execute(Command.NEW_SESSION, capabilities)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:179:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>, driver_command = 'newSession'
params = {'desiredCapabilities': {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJU...AAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}, 'requiredCapabilities': {}}
def execute(self, driver_command, params=None):
> result = self._base_execute(driver_command, params)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/webdriver_patches.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>, driver_command = 'newSession'
params = {'desiredCapabilities': {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJU...AAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}, 'requiredCapabilities': {}}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:238:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f206254f240>
response = {'status': 500, 'value': '{"status":13,"value":{"message":"Session [(null externalkey)] not available and is not among...n","lineNumber":590},{"fileName":"Thread.java","className":"java.lang.Thread","methodName":"run","lineNumber":748}]}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
try:
message = message['message']
except TypeError:
message = None
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = WebDriverException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = WebDriverException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.
E Active sessions are[]
E Stacktrace:
E at org.openqa.grid.internal.ActiveTestSessions.getExistingSession (ActiveTestSessions.java:110)
E at org.openqa.grid.internal.Registry.getExistingSession (Registry.java:404)
E at org.openqa.grid.web.servlet.handler.RequestHandler.getSession (RequestHandler.java:232)
E at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:117)
E at org.openqa.grid.web.servlet.DriverServlet.process (DriverServlet.java:83)
E at org.openqa.grid.web.servlet.DriverServlet.doPost (DriverServlet.java:67)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:707)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:790)
E at org.seleniumhq.jetty9.servlet.ServletHolder.handle (ServletHolder.java:841)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle (ServletHandler.java:543)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle (SessionHandler.java:1584)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle (ContextHandler.java:1228)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:168)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doScope (ServletHandler.java:481)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doScope (SessionHandler.java:1553)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:166)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope (ContextHandler.java:1130)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:141)
E at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
E at org.seleniumhq.jetty9.server.Server.handle (Server.java:564)
E at org.seleniumhq.jetty9.server.HttpChannel.handle (HttpChannel.java:320)
E at org.seleniumhq.jetty9.server.HttpConnection.onFillable (HttpConnection.java:251)
E at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded (AbstractConnection.java:279)
E at org.seleniumhq.jetty9.io.FillInterest.fillable (FillInterest.java:112)
E at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run (ChannelEndPoint.java:124)
E at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred (Invocable.java:122)
E at org.seleniumhq.jetty9.util.thread.strategy.ExecutingExecutionStrategy.invoke (ExecutingExecutionStrategy.java:58)
E at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.produceConsume (ExecuteProduceConsume.java:201)
E at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.run (ExecuteProduceConsume.java:133)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:672)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:590)
E at java.lang.Thread.run (Thread.java:748)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:193: WebDriverException
During handling of the above exception, another exception occurred:
splinter_webdriver = 'remote', retry_count = 2
def get_browser(splinter_webdriver, retry_count=3):
kwargs = get_args(driver=splinter_webdriver,
download_dir=splinter_file_download_dir,
download_ftypes=splinter_download_file_types,
firefox_pref=splinter_firefox_profile_preferences,
firefox_prof_dir=splinter_firefox_profile_directory,
remote_url=splinter_remote_url,
executable=splinter_webdriver_executable,
driver_kwargs=splinter_driver_kwargs)
try:
return splinter_browser_class(
splinter_webdriver, visit_condition=splinter_browser_load_condition,
visit_condition_timeout=splinter_browser_load_timeout,
> wait_time=splinter_wait_time, **kwargs
)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:485:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ('remote',), kwargs = {'browser': 'Firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm1hcmtlcgMAUEsDBBQAAAAIAEaMJUvXGbK...AAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'keep_alive': True, 'url': 'http://localhost:4444/wd/hub/', ...}
visit_condition = <function splinter_browser_load_condition.<locals>.<lambda> at 0x7f2063cbe950>, visit_condition_timeout = 10
def Browser(*args, **kwargs):
"""Emulate splinter's Browser."""
visit_condition = kwargs.pop('visit_condition')
visit_condition_timeout = kwargs.pop('visit_condition_timeout')
> browser = splinter.Browser(*args, **kwargs)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
driver_name = 'remote', args = ()
kwargs = {'browser': 'Firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm1hcmtlcgMAUEsDBBQAAAAIAEaMJUvXGbK...AAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'keep_alive': True, 'url': 'http://localhost:4444/wd/hub/', ...}
driver = <class 'splinter.driver.webdriver.remote.WebDriver'>
def Browser(driver_name='firefox', *args, **kwargs):
"""
Returns a driver instance for the given name.
When working with ``firefox``, it's possible to provide a profile name
and a list of extensions.
If you don't provide any driver_name, then ``firefox`` will be used.
If there is no driver registered with the provided ``driver_name``, this
function will raise a :class:`splinter.exceptions.DriverNotFoundError`
exception.
"""
try:
driver = _DRIVERS[driver_name]
except KeyError:
raise DriverNotFoundError("No driver for %s" % driver_name)
> return driver(*args, **kwargs)
.tox/py36/lib/python3.6/site-packages/splinter/browser.py:63:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <splinter.driver.webdriver.remote.WebDriver object at 0x7f206254fdd8>, url = 'http://localhost:4444/wd/hub/', browser = 'Firefox', wait_time = 5
ability_args = {'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm1hcmtlcgMAUEsDBBQAAAAIAEaMJUvXGbKmkQYAAHkYAAAHAAAAdXNlc...UAxQAAAAIAEaMJUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'keep_alive': True}
browsername = 'FIREFOX'
abilities = {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm...MJUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}
def __init__(self, url=DEFAULT_URL, browser='firefox', wait_time=2, **ability_args):
browsername = browser.upper()
# Handle case where user specifies IE with a space in it
if browsername == 'INTERNET EXPLORER':
browsername = 'INTERNETEXPLORER'
abilities = getattr(DesiredCapabilities, browsername, {})
abilities.update(ability_args)
> self.driver = Remote(url, abilities)
.tox/py36/lib/python3.6/site-packages/splinter/driver/webdriver/remote.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>
args = ('http://localhost:4444/wd/hub/', {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQA...JUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...})
kwargs = {'keep_alive': True}
def __init__(self, *args, **kwargs):
"""Set keep_alive to True."""
kwargs['keep_alive'] = True
> return old_init(self, *args, **kwargs)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/webdriver_patches.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>, command_executor = 'http://localhost:4444/wd/hub/'
desired_capabilities = {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm...MJUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}
browser_profile = None, proxy = None, keep_alive = True, file_detector = None
def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=None, browser_profile=None, proxy=None,
keep_alive=False, file_detector=None):
"""
Create a new driver that will issue commands using the wire protocol.
:Args:
- command_executor - Either a string representing URL of the remote server or a custom
remote_connection.RemoteConnection object. Defaults to 'http://127.0.0.1:4444/wd/hub'.
- desired_capabilities - A dictionary of capabilities to request when
starting the browser session. Required parameter.
- browser_profile - A selenium.webdriver.firefox.firefox_profile.FirefoxProfile object.
Only used if Firefox is requested. Optional.
- proxy - A selenium.webdriver.common.proxy.Proxy object. The browser session will
be started with given proxy settings, if possible. Optional.
- keep_alive - Whether to configure remote_connection.RemoteConnection to use
HTTP keep-alive. Defaults to False.
- file_detector - Pass custom file detector object during instantiation. If None,
then default LocalFileDetector() will be used.
"""
if desired_capabilities is None:
raise WebDriverException("Desired Capabilities can't be None")
if not isinstance(desired_capabilities, dict):
raise WebDriverException("Desired Capabilities must be a dictionary")
if proxy is not None:
proxy.add_to_capabilities(desired_capabilities)
self.command_executor = command_executor
if type(self.command_executor) is bytes or isinstance(self.command_executor, str):
self.command_executor = RemoteConnection(command_executor, keep_alive=keep_alive)
self._is_remote = True
self.session_id = None
self.capabilities = {}
self.error_handler = ErrorHandler()
self.start_client()
> self.start_session(desired_capabilities, browser_profile)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>
desired_capabilities = {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJUsAAAAAAgAAAAAAAAAHAAAALm...MJUvXGbKmkQYAAHkYAAAHAAAAAAAAAAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}
browser_profile = None
def start_session(self, desired_capabilities, browser_profile=None):
"""
Creates a new session with the desired capabilities.
:Args:
- browser_name - The name of the browser to request.
- version - Which browser version to request.
- platform - Which platform to request the browser on.
- javascript_enabled - Whether the new session should support JavaScript.
- browser_profile - A selenium.webdriver.firefox.firefox_profile.FirefoxProfile object. Only used if Firefox is requested.
"""
capabilities = {'desiredCapabilities': {}, 'requiredCapabilities': {}}
for k, v in desired_capabilities.items():
if k not in ('desiredCapabilities', 'requiredCapabilities'):
capabilities['desiredCapabilities'][k] = v
else:
capabilities[k].update(v)
if browser_profile:
capabilities['desiredCapabilities']['firefox_profile'] = browser_profile.encoded
> response = self.execute(Command.NEW_SESSION, capabilities)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:179:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>, driver_command = 'newSession'
params = {'desiredCapabilities': {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJU...AAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}, 'requiredCapabilities': {}}
def execute(self, driver_command, params=None):
> result = self._base_execute(driver_command, params)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/webdriver_patches.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="None")>, driver_command = 'newSession'
params = {'desiredCapabilities': {'acceptInsecureCerts': True, 'browserName': 'firefox', 'firefox_profile': 'UEsDBBQAAAAIADqMJU...AAAAAAC0gScAAAB1c2VyLmpzUEsFBgAAAAACAAIAagAAAN0GAAAAAA==', 'javascriptEnabled': True, ...}, 'requiredCapabilities': {}}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:238:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f20623c6e80>
response = {'status': 500, 'value': '{"status":13,"value":{"message":"Session [(null externalkey)] not available and is not among...n","lineNumber":590},{"fileName":"Thread.java","className":"java.lang.Thread","methodName":"run","lineNumber":748}]}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
try:
message = message['message']
except TypeError:
message = None
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = WebDriverException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = WebDriverException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.
E Active sessions are[]
E Stacktrace:
E at org.openqa.grid.internal.ActiveTestSessions.getExistingSession (ActiveTestSessions.java:110)
E at org.openqa.grid.internal.Registry.getExistingSession (Registry.java:404)
E at org.openqa.grid.web.servlet.handler.RequestHandler.getSession (RequestHandler.java:232)
E at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:117)
E at org.openqa.grid.web.servlet.DriverServlet.process (DriverServlet.java:83)
E at org.openqa.grid.web.servlet.DriverServlet.doPost (DriverServlet.java:67)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:707)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:790)
E at org.seleniumhq.jetty9.servlet.ServletHolder.handle (ServletHolder.java:841)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle (ServletHandler.java:543)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle (SessionHandler.java:1584)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle (ContextHandler.java:1228)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:168)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doScope (ServletHandler.java:481)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doScope (SessionHandler.java:1553)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:166)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope (ContextHandler.java:1130)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:141)
E at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
E at org.seleniumhq.jetty9.server.Server.handle (Server.java:564)
E at org.seleniumhq.jetty9.server.HttpChannel.handle (HttpChannel.java:320)
E at org.seleniumhq.jetty9.server.HttpConnection.onFillable (HttpConnection.java:251)
E at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded (AbstractConnection.java:279)
E at org.seleniumhq.jetty9.io.FillInterest.fillable (FillInterest.java:112)
E at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run (ChannelEndPoint.java:124)
E at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred (Invocable.java:122)
E at org.seleniumhq.jetty9.util.thread.strategy.ExecutingExecutionStrategy.invoke (ExecutingExecutionStrategy.java:58)
E at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.produceConsume (ExecuteProduceConsume.java:201)
E at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.run (ExecuteProduceConsume.java:133)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:672)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:590)
E at java.lang.Thread.run (Thread.java:748)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:193: WebDriverException
During handling of the above exception, another exception occurred:
request = <FixtureRequest for <Function 'test_successfull_login[skin1]'>>
@scenario("Successful login")
> def test_successfull_login():
pcm2_qa/tests/functional/test_login.py:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py36/lib/python3.6/site-packages/pytest_bdd/scenario.py:195: in _execute_scenario
_execute_step_function(request, scenario, step, step_func)
.tox/py36/lib/python3.6/site-packages/pytest_bdd/scenario.py:137: in _execute_step_function
step_func(**kwargs)
.tox/py36/lib/python3.6/site-packages/pytest_bdd/steps.py:165: in step_func
result = get_fixture_value(request, func.__name__)
.tox/py36/lib/python3.6/site-packages/pytest_bdd/utils.py:36: in get_fixture_value
return getfixturevalue(name)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:440: in getfixturevalue
return self._get_active_fixturedef(argname).cached_result[0]
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:465: in _get_active_fixturedef
result = self._getfixturevalue(fixturedef)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:530: in _getfixturevalue
val = fixturedef.execute(request=subrequest)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:767: in execute
fixturedef = request._get_active_fixturedef(argname)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:465: in _get_active_fixturedef
result = self._getfixturevalue(fixturedef)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:530: in _getfixturevalue
val = fixturedef.execute(request=subrequest)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:767: in execute
fixturedef = request._get_active_fixturedef(argname)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:465: in _get_active_fixturedef
result = self._getfixturevalue(fixturedef)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:530: in _getfixturevalue
val = fixturedef.execute(request=subrequest)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:767: in execute
fixturedef = request._get_active_fixturedef(argname)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:465: in _get_active_fixturedef
result = self._getfixturevalue(fixturedef)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:530: in _getfixturevalue
val = fixturedef.execute(request=subrequest)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:767: in execute
fixturedef = request._get_active_fixturedef(argname)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:465: in _get_active_fixturedef
result = self._getfixturevalue(fixturedef)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:530: in _getfixturevalue
val = fixturedef.execute(request=subrequest)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:786: in execute
return ihook.pytest_fixture_setup(fixturedef=self, request=request)
.tox/py36/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py:745: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
.tox/py36/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py:339: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
.tox/py36/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py:334: in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
.tox/py36/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py:613: in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
.tox/py36/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py:254: in _wrapped_call
return call_outcome.get_result()
.tox/py36/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py:279: in get_result
raise ex[1].with_traceback(ex[2])
.tox/py36/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py:265: in __init__
self.result = func()
.tox/py36/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py:614: in execute
res = hook_impl.function(*args)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:816: in pytest_fixture_setup
result = call_fixture_func(fixturefunc, request, kwargs)
.tox/py36/lib/python3.6/site-packages/_pytest/fixtures.py:721: in call_fixture_func
res = fixturefunc(**kwargs)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:571: in browser
return browser_instance_getter(request, browser)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:504: in prepare_browser
browser = browser_pool[browser_key] = get_browser(splinter_webdriver)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:489: in get_browser
return get_browser(splinter_webdriver, retry_count - 1)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:489: in get_browser
return get_browser(splinter_webdriver, retry_count - 1)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:485: in get_browser
wait_time=splinter_wait_time, **kwargs
.tox/py36/lib/python3.6/site-packages/pytest_splinter/plugin.py:68: in Browser
browser = splinter.Browser(*args, **kwargs)
.tox/py36/lib/python3.6/site-packages/splinter/browser.py:63: in Browser
return driver(*args, **kwargs)
.tox/py36/lib/python3.6/site-packages/splinter/driver/webdriver/remote.py:27: in __init__
self.driver = Remote(url, abilities)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/webdriver_patches.py:31: in __init__
return old_init(self, *args, **kwargs)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:92: in __init__
self.start_session(desired_capabilities, browser_profile)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:179: in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
.tox/py36/lib/python3.6/site-packages/pytest_splinter/webdriver_patches.py:56: in execute
result = self._base_execute(driver_command, params)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:238: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f2062411860>
response = {'status': 500, 'value': '{"status":13,"value":{"message":"Session [(null externalkey)] not available and is not among...n","lineNumber":590},{"fileName":"Thread.java","className":"java.lang.Thread","methodName":"run","lineNumber":748}]}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
try:
message = message['message']
except TypeError:
message = None
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = WebDriverException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = WebDriverException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.
E Active sessions are[]
E Stacktrace:
E at org.openqa.grid.internal.ActiveTestSessions.getExistingSession (ActiveTestSessions.java:110)
E at org.openqa.grid.internal.Registry.getExistingSession (Registry.java:404)
E at org.openqa.grid.web.servlet.handler.RequestHandler.getSession (RequestHandler.java:232)
E at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:117)
E at org.openqa.grid.web.servlet.DriverServlet.process (DriverServlet.java:83)
E at org.openqa.grid.web.servlet.DriverServlet.doPost (DriverServlet.java:67)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:707)
E at javax.servlet.http.HttpServlet.service (HttpServlet.java:790)
E at org.seleniumhq.jetty9.servlet.ServletHolder.handle (ServletHolder.java:841)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle (ServletHandler.java:543)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle (SessionHandler.java:1584)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle (ContextHandler.java:1228)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:168)
E at org.seleniumhq.jetty9.servlet.ServletHandler.doScope (ServletHandler.java:481)
E at org.seleniumhq.jetty9.server.session.SessionHandler.doScope (SessionHandler.java:1553)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:166)
E at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope (ContextHandler.java:1130)
E at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:141)
E at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
E at org.seleniumhq.jetty9.server.Server.handle (Server.java:564)
E at org.seleniumhq.jetty9.server.HttpChannel.handle (HttpChannel.java:320)
E at org.seleniumhq.jetty9.server.HttpConnection.onFillable (HttpConnection.java:251)
E at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded (AbstractConnection.java:279)
E at org.seleniumhq.jetty9.io.FillInterest.fillable (FillInterest.java:112)
E at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run (ChannelEndPoint.java:124)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:672)
E at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:590)
E at java.lang.Thread.run (Thread.java:748)
.tox/py36/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:193: WebDriverException
============================================================================================================================ 331 tests deselected =============================================================================================================================
================================================================================================================== 1 failed, 331 deselected in 4.42 seconds ===================================================================================================================
ERROR: InvocationError: '/home/davide/workspaces/pcm2_qa/.tox/py36/bin/py.test --splinter-webdriver=remote --variables=credentials/credentials-DEV-pcmw.yml --splinter-remote-url=http://localhost:4444/wd/hub/ -m login -k skin1 --variables capabilities/browsers/firefox/FIREFOX.json'
___________________________________________________________________________________________________________________________________ summary ___________________________________________________________________________________________________________________________________
ERROR: py36: commands failed
Ok you seem to be using a firefox profile, can you check Diego's guide https://github.com/zalando/zalenium/issues/176#issuecomment-313132398
And make sure you are not missing something? like sharing the volume and so on?
Also, can you clarify if this is something was already working and broke today or if you are trying Zalenium for the first time. The more context the better. Also instead of pasting huge logs here can . you start putting them in a gist.github.com? and just provide the link here so is easier to read the thread. If possible you could move the current logs to gist so we can follow this issue better ;)
Got it for the logs, sorry!
Solved: there were a typo in the docker run command (not matching volume). Tested with chrome and it works fine, thanks!
@elgalu Talking about the Firefox profile (created by default by Splinter): will be supported in future releases executions based on firefox with profiles out of the box? With Browserstack there is no need to additional setup.
If it's handled by Splinter then you seem to be covered.
Glad to read that you sort it out!!
Hi,
I have an existing project based on Selenium Splinter (https://splinter.readthedocs.io/en/latest/). If works fine locally or with a remote browserstack url but if I switch to http://localhost:4444/wd/hub I get the following error:
Any idea? Thanks in advance!