作者:毛毛-刘庆 | 来源:互联网 | 2023-09-01 11:52
Selenium exception (python): "The browser appears to have exited " selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor,check it for details.
log_file:
geckodriver.exe:错误:找到了参数'-e',这不是预期的,或者在这种情况下无效
用法:
geckodriver.exe -v
有关更多信息,请尝试--help
1575724631137 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "C:\\Users\\User\\AppData\\Local\\Temp\\rust_mozprofileHvzCho"
*** You are running in headless mode.
1575724632057 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1575724632057 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
1575724632057 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1575724632057 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
Javascript error: resource://gre/modules/XULStore.jsm,line 66: Error: Can't find profile directory.
1575724635166 Marionette INFO Listening on port 59172
1575724635463 Marionette WARN TLS certificate errors will be ignored for this session
1575724638114 Marionette INFO Stopped listening on port 59172
[Parent 3908,Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc,line 341
[Child 8540,Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc,Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome[Child 9560,line 341
[Child 9560,Chrome_ChildThread] WARNING: pipe error: 109[Child 8672,line 341
[Child 8672,line 341
我的代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
browser = webdriver.Firefox(capabilities=cap,executable_path=r"C:\Program Files\Mozilla Firefox\firefox.exe")
browser.get('http://google.com/')