1

I am trying to launch a chrome session on a node with webdriver.Remote(). I cannot get the browser to launch. I can get it to working with webdriver.Chrome() but not on grid.

I have node and hub running on the same local machine as the client.

Here is Test.py

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import time

driver = webdriver.Remote(
'http://192.168.1.18:4444/wd/hub',
   desired_capabilities=webdriver.DesiredCapabilities.CHROME
)
time.sleep(10)
driver.quit()

Here is the traceback of Test.py when it fails

  Traceback (most recent call last):
  File "RCTest.py", line 8, in <module>
    desired_capabilities=webdriver.DesiredCapabilities.CHROME
  File "/Users/admin/anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/Users/admin/anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Users/admin/anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute
    self.error_handler.check_response(response)
  File "/Users/admin/anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot parse capability: goog:chromeOptions
from unknown error: cannot parse binary
from unknown error: must be a string
  (Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2 milliseconds
Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:37:19.049Z'
System info: host: 'MacM', ip: '192.168.1.18', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '9.0.1'
Driver info: driver.version: unknown
Stacktrace:
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (NativeConstructorAccessorImpl.java:-2)
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance (Constructor.java:488)
    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:195)
    at java.util.Spliterators$ArraySpliterator.tryAdvance (Spliterators.java:958)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    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:476)
    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.ServicedSession$Factory.apply (ServicedSession.java:232)
    at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$11 (ActiveSessionFactory.java:167)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$11$1.accept (ReferencePipeline.java:375)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)
    at java.util.Spliterators$ArraySpliterator.tryAdvance (Spliterators.java:958)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    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:476)
    at org.openqa.selenium.remote.server.ActiveSessionFactory.apply (ActiveSessionFactory.java:170)
    at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$1 (NewSessionPipeline.java:44)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.Collections$2.tryAdvance (Collections.java:4734)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    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:476)
    at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$2 (NewSessionPipeline.java:47)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.DistinctOps$1$2.accept (DistinctOps.java:175)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)
    at java.util.stream.Streams$StreamBuilderImpl.tryAdvance (Streams.java:397)
    at java.util.stream.Streams$ConcatSpliterator.tryAdvance (Streams.java:720)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    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:476)
    at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession (NewSessionPipeline.java:50)
    at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute (BeginSession.java:77)
    at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0 (WebDriverServlet.java:240)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:514)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
    at java.lang.Thread.run (Thread.java:844)

Here is the Hub response:

13:29:28.442 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, se:CONFIG_UUID=5804e13e-503e-4490-99ef-7776c1579caf, browserName=chrome, maxInstances=5, platform=MAC}
13:35:08.137 INFO - Got a request to create a new session: Capabilities {browserName: chrome, version: }
13:35:08.137 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, se:CONFIG_UUID=5804e13e-503e-4490-99ef-7776c1579caf, browserName=chrome, maxInstances=5, platform=MAC}

Here is the Node response:

Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@44652a7f
13:35:08.145 INFO - /session: Executing POST on /session (handler: BeginSession)
13:35:08.148 INFO - Capabilities are: Capabilities {browserName: chrome, goog:chromeOptions: {binary: null}, se:CONFIG_UUID: 5804e13e-503e-4490-99ef-777..., version: }
13:35:08.148 INFO - Capabilities {browserName: chrome, goog:chromeOptions: {binary: null}, se:CONFIG_UUID: 5804e13e-503e-4490-99ef-777..., version: } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 3619
Only local connections are allowed.

Even though the browser doesn't open the chromedriver still makes a LISTENING connection

chromedri 38842 admin    9u  IPv4 0xb74a80d3f95a4bab      0t0  TCP localhost:20917 (LISTEN)

I have launched the node with:

java -jar selenium-server-standalone-3.8.0.jar -role node -hub http://192.168.1.18:4444/grid/register

And the hub with:

java -Dwebdriver.chrome.driver='/chromedriver' -jar selenium-server-standalone-3.8.0.jar -role hub

I have been trying to get this to work and I cannot find what I am missing.

I am running : Python: 2.7.13 Selenium: 3.8

WHAT AM I DOING WRONG XD

I need the chrome browser to launch, please.

UPDATE:

I still havent figured this out buy I switched from Grid to just using Selenium Standalone and I have managed to get eveything working on an AWS Ubunutu Instance. So for now, this will work. I am still wondering why I couldnt get it to work with the Grid.

Aaron N. Brock
  • 4,276
  • 2
  • 25
  • 43
Chris W
  • 49
  • 1
  • 5

1 Answers1

0

Chrome options no longer programmtically set after SeleniumDriver upgrade.

I've just rolled back my SeleniumDriver upgrade to test this functionality with our previous SeleniumDriver version: 2.35.0 It works as expected.

See this

https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/7043

Akshay Bahadur
  • 497
  • 4
  • 11
  • Would be cool to see an implementation in python that satisfies the parsing issues. I've tried setting ChromeOptions but no luck. I will consider rolling it back. – Chris W Dec 01 '17 at 19:17
  • for instance : [link](https://stackoverflow.com/questions/13227346/set-chrome-options-with-remote-driver) Still not working for me. And I have rolled back. Top error is still: _selenium.common.exceptions.WebDriverException: Message: u"unknown error: cannot parse capability: goog:chromeOptions\nfrom unknown error: cannot parse binary\nfrom unknown error: must be a string_ – Chris W Dec 01 '17 at 19:36