Skip to content

Instantly share code, notes, and snippets.

@stephenash
Last active August 19, 2017 15:55
Show Gist options
  • Save stephenash/764d21034179d55fe7472dfe1ddd5620 to your computer and use it in GitHub Desktop.
Save stephenash/764d21034179d55fe7472dfe1ddd5620 to your computer and use it in GitHub Desktop.
$ python3 script.py
Traceback (most recent call last):
File "script.py", line 27, in <module>
desired_capabilities=capabilities)
File "/private/tmp/py-sel/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 140, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/private/tmp/py-sel/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 229, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/private/tmp/py-sel/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 297, in execute
self.error_handler.check_response(response)
File "/private/tmp/py-sel/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot parse capability: chromeOptions
from unknown error: cannot parse mobileEmulation
from unknown error: 'width' must be an integer
(Driver info: chromedriver=2.31.488774 (7e15618d1bf16df8bf0ecf2914ed1964a387ba0b),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 29 milliseconds
Build info: version: '3.5.0', revision: '8def36e068', time: '2017-08-10T23:00:22.093Z'
System info: host: 'sash-mbp', ip: '2601:602:9400:8fa0:78e8:1977:e2f4:c985', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144'
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:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed (ErrorHandler.java:167)
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$24 (ProtocolHandshake.java:360)
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:363)
at org.openqa.selenium.remote.server.ServicedSession$Factory.apply (ServicedSession.java:159)
at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$createSession$15 (ActiveSessionFactory.java:148)
at java.util.Optional.map (Optional.java:215)
at org.openqa.selenium.remote.server.ActiveSessionFactory.createSession (ActiveSessionFactory.java:148)
at org.openqa.selenium.remote.server.BeginSession.execute (BeginSession.java:69)
at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0 (WebDriverServlet.java:231)
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)
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
capabilities = {
"browserName": "chrome",
"chromeOptions": {
"args": [
"disable-infobars",
"incognito"
],
"mobileEmulation": {
"deviceMetrics": {
"width": 360,
"height": 640,
"pixelRatio": 3
},
"userAgent": "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36"
}
},
"platform_tag": "",
"build": "defaultbuild 2017-8-18 13:00",
"tunnelIdentifier": "pandora.fciis.net"
}
driver = webdriver.Remote(
command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=capabilities)
driver.get("http://www.python.org")
driver.close()
$ java -Dwebdriver.chrome.driver=.selenium/chromedriver/2.31-x64-chromedriver -jar .selenium/selenium-server/3.4.0-server.jar
08:22:12.583 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
08:22:12.584 INFO - Launching a standalone Selenium Server
2017-08-19 08:22:12.601:INFO::main: Logging initialized @210ms to org.seleniumhq.jetty9.util.log.StdErrLog
08:22:12.643 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
08:22:12.643 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
08:22:12.644 INFO - Driver class not found: com.opera.core.systems.OperaDriver
08:22:12.644 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
08:22:12.644 INFO - Driver class not found: com.opera.core.systems.OperaDriver
08:22:12.644 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
2017-08-19 08:22:12.686:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-08-19 08:22:12.725:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@2b98378d{/,null,AVAILABLE}
2017-08-19 08:22:12.761:INFO:osjs.AbstractConnector:main: Started ServerConnector@5442a311{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-08-19 08:22:12.762:INFO:osjs.Server:main: Started @370ms
08:22:12.763 INFO - Selenium Server is up and running
08:22:14.874 INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneTimeout 1800000 polling every 180000
08:22:14.894 INFO - Executing: [new session: Capabilities [{platform_tag=, tunnelIdentifier=pandora.fciis.net, build=defaultbuild 2017-8-18 13:00, browserName=chrome, chromeOptions={args=[disable-infobars, incognito], mobileEmulation={deviceMetrics={pixelRatio=3, width=360, height=640}, userAgent=Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36}}}]])
08:22:14.909 INFO - Creating a new session for Capabilities [{platform_tag=, tunnelIdentifier=pandora.fciis.net, build=defaultbuild 2017-8-18 13:00, browserName=chrome, chromeOptions={args=[disable-infobars, incognito], mobileEmulation={deviceMetrics={pixelRatio=3, width=360, height=640}, userAgent=Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36}}}]
Starting ChromeDriver 2.31.488774 (7e15618d1bf16df8bf0ecf2914ed1964a387ba0b) on port 7599
Only local connections are allowed.
08:22:15.815 INFO - Detected dialect: OSS
08:22:15.836 INFO - Done: [new session: Capabilities [{platform_tag=, tunnelIdentifier=pandora.fciis.net, build=defaultbuild 2017-8-18 13:00, browserName=chrome, chromeOptions={args=[disable-infobars, incognito], mobileEmulation={deviceMetrics={pixelRatio=3, width=360, height=640}, userAgent=Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36}}}]]
08:22:15.851 INFO - Executing: [get: http://www.python.org])
08:22:16.595 INFO - Done: [get: http://www.python.org]
08:22:16.599 INFO - Executing: [close window])
08:22:16.734 INFO - Done: [close window]
$ java -Dwebdriver.chrome.driver=.selenium/chromedriver/2.31-x64-chromedriver -jar .selenium/selenium-server/3.5.0-server.jar
08:24:23.978 INFO - Selenium build info: version: '3.5.0', revision: '8def36e068'
08:24:23.979 INFO - Launching a standalone Selenium Server
2017-08-19 08:24:23.994:INFO::main: Logging initialized @207ms to org.seleniumhq.jetty9.util.log.StdErrLog
08:24:24.042 INFO - Driver class not found: com.opera.core.systems.OperaDriver
08:24:24.070 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
08:24:24.070 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
08:24:24.101 INFO - Using the passthrough mode handler
2017-08-19 08:24:24.133:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-08-19 08:24:24.165:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@5383967b{/,null,STARTING} has uncovered http methods for path: /
2017-08-19 08:24:24.169:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@5383967b{/,null,AVAILABLE}
2017-08-19 08:24:24.203:INFO:osjs.AbstractConnector:main: Started ServerConnector@35d176f7{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-08-19 08:24:24.204:INFO:osjs.Server:main: Started @418ms
08:24:24.205 INFO - Selenium Server is up and running
2017-08-19 08:24:27.225:INFO:osjshC.ROOT:qtp1130478920-12: org.openqa.selenium.remote.server.WebDriverServlet-1593948d: Initialising WebDriverServlet
08:24:27.266 INFO - Binding default provider to: org.openqa.selenium.chrome.ChromeDriverService
08:24:27.267 INFO - Found handler: org.openqa.selenium.remote.server.BeginSession@d932a1e
08:24:27.269 INFO - /session: Executing POST on /session (handler: BeginSession)
08:24:27.313 INFO - Mismatched capabilities. Creating a synthetic w3c capability.
08:24:27.317 INFO - Capabilities are: Capabilities {platform_tag=, tunnelIdentifier=pandora.fciis.net, build=defaultbuild 2017-8-18 13:00, browserName=chrome, chromeOptions={args=[disable-infobars, incognito], mobileEmulation={deviceMetrics={width=360.0, height=640.0, pixelRatio=3.0, }, userAgent=Mozilla/5.0 (Linux; Android..., }, }, }
08:24:27.318 INFO - Capabilities {platform_tag=, tunnelIdentifier=pandora.fciis.net, build=defaultbuild 2017-8-18 13:00, browserName=chrome, chromeOptions={args=[disable-infobars, incognito], mobileEmulation={deviceMetrics={width=360.0, height=640.0, pixelRatio=3.0, }, userAgent=Mozilla/5.0 (Linux; Android..., }, }, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
08:24:27.318 INFO - Capabilities {platform_tag=, tunnelIdentifier=pandora.fciis.net, build=defaultbuild 2017-8-18 13:00, browserName=chrome, chromeOptions={args=[disable-infobars, incognito], mobileEmulation={deviceMetrics={width=360.0, height=640.0, pixelRatio=3.0, }, userAgent=Mozilla/5.0 (Linux; Android..., }, }, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
08:24:27.318 INFO - Capabilities {platform_tag=, tunnelIdentifier=pandora.fciis.net, build=defaultbuild 2017-8-18 13:00, browserName=chrome, chromeOptions={args=[disable-infobars, incognito], mobileEmulation={deviceMetrics={width=360.0, height=640.0, pixelRatio=3.0, }, userAgent=Mozilla/5.0 (Linux; Android..., }, }, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.31.488774 (7e15618d1bf16df8bf0ecf2914ed1964a387ba0b) on port 2609
Only local connections are allowed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment