Skip to content

Testing with Selenium Grid get SessionNotCreatedException #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
clobob opened this issue May 17, 2020 · 6 comments
Closed

Testing with Selenium Grid get SessionNotCreatedException #572

clobob opened this issue May 17, 2020 · 6 comments
Labels
external Outside SeleniumBase's scope. / Ask somewhere else.

Comments

@clobob
Copy link

clobob commented May 17, 2020

I'm trying to run a test in examples\visual_testing. The command which I used like this:

pytest python_home_test.py --server=192.168.1.101 --cap_file=..\capabilities\local_cap_file_firefox.py --browser=remote

Selenium Grid docker -->> selenium/hub, selenium/node-firfox
OS: Linux localhost.localdomain 3.10.0-862.9.1.nd7.zx.4.x86_64 #1 SMP Wed Jan 9 01:27:43 CST 2019 x86_64 x86_64 x86_64 GNU/Linux

Selenium grid looks working ok.

after running test, I get a failed with stacktrace:

E selenium.common.exceptions.SessionNotCreatedException: Message: Unable to create session from {
E "desiredCapabilities": {
E "server:CONFIG_UUID": "e9e2ba04-f65c-42c6-830b-3ad01b57e376",
E "os": "LINUX",
E "browser": "firefox"
E },
E "capabilities": {
E "firstMatch": [
E {
E "server:CONFIG_UUID": "e9e2ba04-f65c-42c6-830b-3ad01b57e376"
E }
E ]
E }
E }
E Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
E System info: host: '9636b7966d94', ip: '172.17.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.9.1.nd7.zx.4.x86_64', java.version: '1.8.0_252'
E Driver info: driver.version: unknown
E Stacktrace:
E at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$4 (NewSessionPipeline.java:76)
E at java.util.Optional.orElseThrow (Optional.java:290)
E at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$5 (NewSessionPipeline.java:75)
E at java.util.Optional.orElseGet (Optional.java:267)
E at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession (NewSessionPipeline.java:73)
E at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute (BeginSession.java:65)
E at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0 (WebDriverServlet.java:235)
E at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
E at java.util.concurrent.FutureTask.run (FutureTask.java:266)
E at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
E at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
E at java.lang.Thread.run (Thread.java:748)

......\envs\seleniumbase_env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: SessionNotCreatedException

can you have a look at this issue?

@mdmintz
Copy link
Member

mdmintz commented May 17, 2020

@clobob This might be related to your settings in local_cap_file_firefox.py. I'd need to see what you set in there to debug your issue. Do your tests work with a different desired_capabilities file?

@clobob
Copy link
Author

clobob commented May 17, 2020

Hi,
here it is.
desired_cap = {
'os': 'LINUX',
'browser': 'firefox',
}

@mdmintz
Copy link
Member

mdmintz commented May 18, 2020

@clobob If the Selenium Grid nodes that are connected to your Grid Hub are only on Linux machines, you shouldn't need to specify Linux in your desired capabilities. And if none of the Grid Nodes are on Linux, it will have errors. The Desired Capabilities feature that's built-in to SeleniumBase is primarily made for connecting to giant Selenium Grids held by companies such as BrowserStack, Sauce Labs, TestingBot, CrossBrowserTesting, and LambdaTest, which have Selenium Grid nodes running on all kinds of environments. Details on those are here: https://seleniumbase.io/seleniumbase/utilities/selenium_grid/ReadMe/
Although SeleniumBase lets you spin up a Selenium Grid Hub and Selenium Grid nodes, your environment might not support all the desired capabilities that are specified in your desired capabilities file.

@mdmintz mdmintz added the external Outside SeleniumBase's scope. / Ask somewhere else. label May 20, 2020
@clobob
Copy link
Author

clobob commented May 22, 2020

@mdmintz
I feel there is still something wrong in seleniumbase.

  1. I built an evironment in CentOS7 + python 3.6.8 + seleniumbase + docker selenium/hub:latest + docker selenium/node-firefox:latest
  2. I try original selenium to access grid by using follow codes ==>> demo_test.py

from selenium.webdriver import Remote

driver = Remote(command_executor='http://10.0.2.15:4444/wd/hub/',desired_capabilities={'browserName':'firefox'})

driver.get("http://www.baidu.com")
print(driver.title)
driver.close()

the command is : python demo_test.py -v
and it works. site's title is print on screen.

  1. Try to run ==>> pytest python_home_test.py --server=10.0.2.15 --browser=remote cap_file=cap_file.py
    I got SessionNotCreateException like i mentioned in this issue.
    the code in cap_file.py ==>>
    desired_cap={"browser":"firefox"}

@mdmintz
Copy link
Member

mdmintz commented May 22, 2020

@clobob Try the Selenoid Docker image. There's an example here: https://github.com/mpolynskyi/orbitz_seleniumbase
It could be that some Docker images are incompatible with SeleniumBase, possibly something on their end. In any case, there are Docker images that have perfect compatibility with SeleniumBase, which means the issue might be with the selenium/hub:latest Docker image.

@mdmintz
Copy link
Member

mdmintz commented May 22, 2020

And there's https://github.com/seleniumbase/SeleniumBase/releases/tag/v1.38.5 which fixes the issue with Remote WebDriver and Selenium Grid

@mdmintz mdmintz closed this as completed May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Outside SeleniumBase's scope. / Ask somewhere else.
Projects
None yet
Development

No branches or pull requests

2 participants