I am trying to execute the following code in Python with Selenium:
def create_browser(first_page=None):
print "Starting"
browser = webdriver.Chrome()
if first_page:
browser.get(first_page);
print "Done."
return browser
browser = create_browser()
When I execute this code, Chromium starts but the "Done" statement doesn't get printed. However, if I replace Chrome()
by Firefox()
the browser starts and "Done" gets printed. I tried to verfiy this in terminal too. If I execute following series of statements:
from selenium import webdriver
driver = webdriver.Chrome()
When I replace Chrome()
by Firefox()
the terminal returns normally and displays >>
(in the python shell but that doesn't happen with Chromium. Can anyone tell what's going wrong here. I really appreciate your help. Thanks!
Update:
I am not sure if this helps but when I execute using webdriver
a file called chromedriver.log
gets generated in the directory containing my code. It has the following contents:
[0.000][INFO]: ChromeDriver 20.0.1133.0 /home/therookie/bin/chromedriver
[1.000][FINE]: Initializing session with capabilities {
"browserName": "chrome",
"chromeOptions": {
"args": [ ],
"extensions": [ ]
},
"javascriptEnabled": true,
"platform": "ANY",
"version": ""
}
[1.001][INFO]: Launching chrome: /usr/bin/google-chrome --disable-hang-monitor --disable-prompt-on-repost --dom-automation --full-memory-crash-report --no-default-browser-check --no-first-run --ignore-certificate-errors --homepage=about:blank
[11.796][SEVERE]: Failed to initialize connection