Selenium python加载页面driver.get('http://page.com/')打开空窗口的问题

问题描述 投票:0回答:2
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary


browser = webdriver.Firefox(executable_path=r'/usr/bin/firefox')
browser.get("http://google.com/")

Ubuntu 16 LTS用户在这里。在输入url并且在那里没有加载的页面后,如何解决此空白窗口问题。

输出:

> > Traceback (most recent call last):   File "/home/pc/PycharmProjects/calculator/test.py", line 781, in <module>
>     browser = webdriver.Firefox(executable_path=r'/usr/bin/firefox')   File
> "/home/pc/PycharmProjects/calculator/venv/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py",
> line 164, in __init__
>     self.service.start()   File "/home/pc/PycharmProjects/calculator/venv/lib/python3.5/site-packages/selenium/webdriver/common/service.py",
> line 98, in start
>     self.assert_process_still_running()   File "/home/pc/PycharmProjects/calculator/venv/lib/python3.5/site-packages/selenium/webdriver/common/service.py",
> line 111, in assert_process_still_running
>     % (self.path, return_code) selenium.common.exceptions.WebDriverException: Message: Service
> /usr/bin/firefox unexpectedly exited. Status code was: 0
python selenium selenium-webdriver ubuntu-16.04
2个回答
1
投票
browser = webdriver.Firefox(executable_path="path of geckodriver")

-1
投票
export PATH=$PATH:/path/to/driver/firefox-driver
© www.soinside.com 2019 - 2024. All rights reserved.