selenium.common.exceptions.WebDriverException: Message: disconnected: Unable to receive message from renderer
? (failed to check if window was closed: disconnected: not connected to DevTools)
? (Session info: MicrosoftEdge=115.0.xxxx.xxx)
from selenium import webdriver
# 創(chuàng)建EdgeOptions實(shí)例
edge_options = webdriver.EdgeOptions()
edge_options.use_chromium = True
# 添加啟動(dòng)參數(shù)
edge_options.add_argument("--no-sandbox")
edge_options.add_argument("--disable-gpu")
edge_options.add_argument("--disable-dev-shm-usage")
# 創(chuàng)建WebDriver實(shí)例
driver = webdriver.Edge(options=edge_options)
# 啟動(dòng)瀏覽器
url = "https://baidu.com"
driver.get(url)
print(driver.title)
# 關(guān)閉瀏覽器
driver.quit()
if __name__ == "__main__":
run_code = 0
????????示例中使用的是最新版本的webdriver.EdgeOptions()
創(chuàng)建edge_options
實(shí)例。然后使用webdriver.Edge(options=edge_options)
創(chuàng)建了Microsoft Edge的WebDriver實(shí)例。
????????將打開Microsoft Edge瀏覽器,導(dǎo)航到"https://baidu.com"網(wǎng)址,并輸出頁面標(biāo)題。接下來,它將關(guān)閉瀏覽器。
????????確保已正確安裝了最新版本的msedgedriver.exe
驅(qū)動(dòng)程序,并且Microsoft Edge瀏覽器與驅(qū)動(dòng)程序版本相匹配。這樣才能成功啟動(dòng)Microsoft Edge瀏覽器。文章來源:http://www.zghlxwxcb.cn/news/detail-764112.html
????????如果仍然遇到問題,確認(rèn)操作系統(tǒng)、Selenium、WebDriver和Microsoft Edge瀏覽器的版本兼容。文章來源地址http://www.zghlxwxcb.cn/news/detail-764112.html
到了這里,關(guān)于[Selenium]Message: disconnected: Unable to receive message from rendererXXX:報(bào)錯(cuò)解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!