我正在尝试使用 Selenium 的网络驱动程序访问网页,但无论我使用哪种浏览器(Opera/Firefox/GoogleChrome),我都无法访问该网页。
在任何情况下,浏览器都会弹出并挂在那里,不访问任何 URL。
当我尝试运行我的脚本时,我得到
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/bin/[opera/chrome]
如果我使用 Firefox,我会得到:
selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/firefox unexpectedly exited. Status code was: 0
我的代码:
browser = webdriver.Firefox(executable_path=FIREFOX_PATH)
browser.get('www.google.com')
r = BeautifulSoup(browser.page_source, PARSER)
print(r.text)
我正在使用带有 python3.6 的 Linux Ubuntu 18.04