Selenium launches the wrong browser (default)
tl / dr: What am I doing wrong?
I am trying to run selenium tests locally and be Browserstack platform compatible. I am using this code to connect locally:
wd = webdriver.Remote('http://xxxxxxxx@hub.browserstack.com:80/wd/hub', {'browser':'firefox'})
wd.get('http://google.com')
wd.get_screenshot_as_file('/tmp/googl.png')
wd.close()
I see a good screenshot of the /tmp/
.
Now I am trying to do the same with local Selenium:
$ java -jar /usr/share/java/selenium-server-standalone-2.44.0.jar &
The server starts nominally. I am trying to create a session with Firefox (30.0), it works correctly. (The default browser is Opera.)
Then I try to run Python code:
wd = webdriver.Remote('http://localhost:4444/wd/hub', {'browser':'firefox'})
wd.get('http://google.com')
wd.get_screenshot_as_file('/tmp/googl2.png')
wd.close()
Selenium opens Opera instead of Firefox.
I can see this in the Python console:
Message: <html>
<head>
<title>Error 500 org/json/JSONObject</title>
</head>
<body>
<h2>HTTP ERROR: 500</h2><pre>org/json/JSONObject</pre>
<p>RequestURI=/wd/hub/session</p>
<p><i><small><a href="http://jetty.mortbay.org">Powered by Jetty://</a></small></i></p>
Why does it open Opera instead of Firefox?
+3
source to share