关闭弹出窗口后Python Selenium Firefox驱动程序崩溃

2024-06-01 05:46:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用python selenium脚本打开了多个弹出窗口。当我关闭其中一个弹出窗口时,驱动程序对象会崩溃。此外,我无法访问驱动程序对象。你能帮我解决这个问题吗

代码片段:

driver.switch_to.window(driver.window_handles[2])
driver.close()
time.sleep(5)
driver.switch_to.window(driver.window_handles[1])

错误输出:

2021-04-21 09:55:47 ERROR    The Exception in Virtual Media Testcases: Message: Failed to decode response from marionette

<class 'selenium.common.exceptions.WebDriverException'> test_selenium.py 560
2

geckodriver.log:

1619015645365   webdriver::server   DEBUG   -> DELETE /session/c1318c5d-796b-4564-bdc9-68a95bb7cac4/window 
1619015645366   Marionette  TRACE   0 -> [0,638,"WebDriver:CloseWindow",{}]
1619015645391   Marionette  DEBUG   Received observer notification message-manager-disconnect

###!!! [Child][DispatchAsyncMessage] Error: PFilePicker::Msg___delete__ Route error: message sent to unknown actor ID

1619015645414   Marionette  TRACE   0 <- [1,638,null,["2147483649","2147483658"]]
1619015645416   webdriver::server   DEBUG   <- 200 OK {"value":["2147483649","2147483658"]}
1619015645419   webdriver::server   DEBUG   -> GET /session/c1318c5d-796b-4564-bdc9-68a95bb7cac4/window/handles 
1619015645419   Marionette  TRACE   0 -> [0,639,"WebDriver:GetWindowHandles",{}]
1619015645420   Marionette  TRACE   0 <- [1,639,null,["2147483649","2147483658"]]
1619015645420   webdriver::server   DEBUG   <- 200 OK {"value":["2147483649","2147483658"]}
1619015645421   webdriver::server   DEBUG   -> POST /session/c1318c5d-796b-4564-bdc9-68a95bb7cac4/window {"handle": "2147483649"}
1619015645422   Marionette  TRACE   0 -> [0,640,"WebDriver:SwitchToWindow",{"handle":"2147483649","name":"2147483649"}]
1619015645422   Marionette  TRACE   0 <- [1,640,null,{}]
1619015645422   webdriver::server   DEBUG   <- 200 OK {"value":null}
1619015645424   webdriver::server   DEBUG   -> GET /session/c1318c5d-796b-4564-bdc9-68a95bb7cac4/screenshot 
1619015645424   Marionette  TRACE   0 -> [0,641,"WebDriver:TakeScreenshot",{"full":false,"highlights":[],"id":null}]
[Parent 77210, Gecko_IOThread] WARNING: pipe error (55): Connection reset by peer: file /builddir/build/BUILD/firefox-60.1.0/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353

###!!! [Parent][MessageChannel] Error: (msgtype=0x15007F,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv


###!!! [Parent][MessageChannel] Error: (msgtype=0x15007F,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv

1619015645445   Marionette  DEBUG   Register listener.js for window 32
1619015645477   Marionette  DEBUG   Register listener.js for window 34
A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down
1619015645539   Marionette  DEBUG   Received DOM event unload for [object XULDocument]
1619015645546   Marionette  DEBUG   Received observer notification message-manager-disconnect
1619015645548   Marionette  TRACE   0 <- [1,641,null,{}]
1619015645565   webdriver::server   DEBUG   <- 500 Internal Server Error {"value":{"error":"unknown error","message":"Failed to find value field","stacktrace":""}}
1619015645567   webdriver::server   DEBUG   -> DELETE /session/c1318c5d-796b-4564-bdc9-68a95bb7cac4 
1619015645569   webdriver::server   DEBUG   Deleting session
1619015645574   Marionette  DEBUG   Closed connection 0
1619015645657   Marionette  DEBUG   Received observer notification xpcom-will-shutdown
1619015645657   Marionette  DEBUG   New connections will no longer be accepted

驾驶员信息:

Selenium Version: 3.11.0

{
   "rotatable":false,
   "browserVersion":"60.1.0",
   "timeouts":{
      "pageLoad":300000,
      "implicit":0,
      "script":30000
   },
   "acceptInsecureCerts":true,
   "moz:headless":false,
   "moz:geckodriverVersion":"0.26.0",
   "moz:webdriverClick":true,
   "moz:profile":"/tmp/rust_mozprofileEdeK7L",
   "moz:accessibilityChecks":false,
   "browserName":"firefox",
   "moz:useNonSpecCompliantPointerOrigin":false,
   "platformVersion":"3.10.0-862.6.3.el7.x86_64",
   "moz:processID":359676,
   "pageLoadStrategy":"normal",
   "platformName":"linux"
}

Tags: todebugservervaluesessiondrivertraceerror