Image(s): selenium/standalone-chrome-debug
Docker-Selenium Image Version(s): 3.12.0-boron
Docker Version: 18.03.0-ce
OS: Ubuntu 16.04.4
Running Chrome with --user-data-dir=/home/seluser/userdata when the folder already has user data from previous runs should work. This works in 3.12.0-americium.
selenium.webdriver.Remote times out after 60 seconds with WebDriverException: Message: chrome not reachable
selenium:
image: selenium/standalone-chrome-debug:3.12.0-boron
shm_size: 2GB
environment:
- SCREEN_WIDTH=1920
- SCREEN_HEIGHT=1200
- SCREEN_DEPTH=24
ports:
- 8591:5900
from selenium import webdriver
def create_browser_and_quit():
options = webdriver.ChromeOptions()
options.add_argument('--user-data-dir=/home/seluser/userdata')
capabilities = options.to_capabilities()
print('creating')
browser = webdriver.Remote(
command_executor='http://selenium:4444/wd/hub',
desired_capabilities=capabilities,
)
print('quitting')
browser.quit()
create_browser_and_quit()
create_browser_and_quit()
print('done')
$ python reproduce_selenium_bug.py
creating
quitting
creating
Traceback (most recent call last):
... see below
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
(Driver info: chromedriver=2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf),platform=Linux 4.4.0-1057-aws x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.10 seconds
Complete traceback
Traceback (most recent call last):
File "reproduce_selenium_bug.py", line 19, in <module>
browser = create_browser()
File "reproduce_selenium_bug.py", line 10, in create_browser
desired_capabilities=capabilities,
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 245, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 314, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
(Driver info: chromedriver=2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf),platform=Linux 4.4.0-1057-aws x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.10 seconds
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: '70c8246127da', ip: '172.18.0.5', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-1057-aws', java.version: '1.8.0_171'
Driver info: driver.version: unknown
Stacktrace:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (NativeConstructorAccessorImpl.java:-2)
at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance (Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable (ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed (ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0 (JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2 (JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0 (ProtocolHandshake.java:123)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance (Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:73)
at org.openqa.selenium.remote.server.RemoteSession$Factory.performHandshake (RemoteSession.java:145)
at org.openqa.selenium.remote.server.ServicedSession$Factory.apply (ServicedSession.java:159)
at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12 (ActiveSessionFactory.java:176)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$11$1.accept (ReferencePipeline.java:373)
at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:175)
at java.util.Spliterators$ArraySpliterator.tryAdvance (Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:464)
at org.openqa.selenium.remote.server.ActiveSessionFactory.apply (ActiveSessionFactory.java:179)
at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$2 (NewSessionPipeline.java:65)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:175)
at java.util.Collections$2.tryAdvance (Collections.java:4717)
at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:464)
at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$3 (NewSessionPipeline.java:68)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193)
at java.util.stream.DistinctOps$1$2.accept (DistinctOps.java:175)
at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:175)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:175)
at java.util.stream.Streams$StreamBuilderImpl.tryAdvance (Streams.java:405)
at java.util.stream.Streams$ConcatSpliterator.tryAdvance (Streams.java:728)
at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:464)
at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession (NewSessionPipeline.java:71)
at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute (BeginSession.java:65)
at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$1 (WebDriverServlet.java:246)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
probably the most well-written issue the selenium repository has ever seen. thanks for this! :tada:
regarding your issue - just some thinker questions... what's the purpose of re-using a user-data-dir?
Also to point out that the difference between 3.12.0-americium and 3.12.0-boron in Chrome related terms is the Chrome version (from 66 to 67) and the ChromeDriver version (from 2.38 to 2.39).
I think the issue could be related to one of those upgrades.
@ddavison Thanks 馃檪
I'd like to test that a feature works after browser is restarted. If I don't pass --user-data-dir cookies will be gone after I quit.
Hi @Perlence,
It seems this was a bug introduced by ChromeDriver 2.39, which was fixed in their 2.40 release, see release notes here.
We recently released a version of the docker-selenium images where ChromeDriver 2.40 is present.
https://github.com/SeleniumHQ/docker-selenium/releases/tag/3.12.0-cobalt
I will close this issue since this was a bug in ChromeDriver and not related to the docker-selenium images.
Cool, thank you!
Thx