亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Python selenium 瀏覽器 firefox

Python selenium 瀏覽器 firefox

慕村225694 2022-06-14 10:59:49
想知道為什么這不起作用from selenium import webdriverbrowser = webdriver.Firefox()browser.get('https://www.google.com')錯誤:Traceback (most recent call last):  File "C:/Users/cycli/Desktop/test.py", line 2, in <module>    browser = webdriver.Firefox()  File "D:\Python\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__    self.service.start()  File "D:\Python\lib\site-packages\selenium\webdriver\common\service.py", line 98, in start    self.assert_process_still_running()  File "D:\Python\lib\site-packages\selenium\webdriver\common\service.py", line 111, in assert_process_still_running    % (self.path, return_code)selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: 3221225595
查看完整描述

2 回答

?
慕田峪4524236

TA貢獻1875條經驗 獲得超5個贊

最后的代碼塊:


from selenium import webdriver

driver = webdriver.Firefox()

driver.get("http://www.google.com")


查看完整回答
反對 回復 2022-06-14
?
精慕HU

TA貢獻1845條經驗 獲得超8個贊

從以下鏈接下載 Firefox 的 geckodriver,


https://github.com/mozilla/geckodriver/releases

geckodriver 必須在代碼路徑中,或者必須指定它的路徑。


from selenium.webdriver.firefox.options import Options

#Setting up FireFox Driver Options

driver_options = Options()

profile = webdriver.FirefoxProfile()

#driver_options.add_argument("--headless")

driver = webdriver.Firefox(

                firefox_profile=profile, 

                options=driver_options,

                executable_path="geckodriver.exe")


查看完整回答
反對 回復 2022-06-14
  • 2 回答
  • 0 關注
  • 158 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號