国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

一文解決:selenium.common.exceptions.SessionNotCreatedException: Message: session not created

這篇具有很好參考價值的文章主要介紹了一文解決:selenium.common.exceptions.SessionNotCreatedException: Message: session not created。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

1.問題原因

你遇到的錯誤消息表明您正在使用的ChromeDriver的版本與您計算機上安裝的Google Chrome版本不兼容。ChromeDriver是一個獨立的可執(zhí)行文件,WebDriver使用它來控制Chrome瀏覽器。要解決這個問題,您有幾個可能的解決方案,具體介紹如下所示。

2.解決辦法

1.修改ChromeDriver的版本

此方法需要首先查看當(dāng)前Chrome瀏覽器的版本(打開瀏覽器設(shè)置,點擊關(guān)于Chrome即可查看),然后到對應(yīng)的ChromeDriver官網(wǎng)ChromeDriver驅(qū)動下載地址下載與當(dāng)前Chrome瀏覽器一致的驅(qū)動文件,然后查詢python環(huán)境中的ChromeDriver的位置(按下Win+R輸入cmd,然后輸入where chromedriver),最后將下載的最新版本的驅(qū)動文件與之更新即可解決問題。具體操作步驟可以參考博客修改驅(qū)動版本解決問題。
一文解決:selenium.common.exceptions.SessionNotCreatedException: Message: session not created,selenium,測試工具

方法評價: 我覺得此方法不太好,因為Chrome瀏覽器會時刻自動更新,你時刻需要根據(jù)Chrome的版本更新情況手動更新ChromeDriver的版本并替換,不能一勞永逸,這里我不推薦這種方法。

2.降級Google Chrome

如果你的ChromeD因版本太高而導(dǎo)致無法更新到對應(yīng)版本的ChromeDriver,你可以嘗試將Chrome瀏覽器的版本降級到與當(dāng)前ChromeDriver支持的版本相匹配的版本。因此只需要卸載當(dāng)前版本的Chrome,然后下載并安裝與ChromeDriver對應(yīng)的舊版本即可。
方法評價:這種方法仍然不推薦,因為卸載和安裝Chrome本身就更比較繁瑣和費時,下載后的Chrome往往默認就是最新版本,而且如果你下載安裝舊版本,瀏覽器也會自動更新到最新Chrome版本,如果想阻止更新還需要關(guān)閉Chrome自動更新的操作,總之實現(xiàn)起來很繁瑣和復(fù)雜,所以我不推薦。

3.使用WebDriverManager

WebDriverManager是一個庫,可以根據(jù)您使用的瀏覽器版本自動下載適當(dāng)?shù)腤ebDriver可執(zhí)行文件。它消除了手動管理WebDriver二進制文件的需求。您可以使用pip(Python包管理器)安裝WebDriverManager,然后修改您的代碼以使用WebDriverManager來處理WebDriver二進制文件。
具體實現(xiàn)步驟如下所示:
1.下載安裝WebDriverManager模塊;

pip install webdriver_manager

2.修改代碼以使用WebDriverManager管理驅(qū)動文章來源地址http://www.zghlxwxcb.cn/news/detail-715647.html

#配置參數(shù)
from selenium.webdriver import Chrome
opt = Options()
opt.add_argument("--headless")
opt.add_argument("--disbale-gpu")
web = Chrome(options=opt)

# 將上述代碼修改為===>
from selenium.webdriver import Chrome
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
# 創(chuàng)建一個Service對象
service = Service(ChromeDriverManager().install())
#配置參數(shù)
opt = Options()
opt.add_argument("--headless")
opt.add_argument("--disbale-gpu")
web = Chrome(service=service, options=opt)
# 即可解決問題

到了這里,關(guān)于一文解決:selenium.common.exceptions.SessionNotCreatedException: Message: session not created的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • chrome瀏覽器版本和Chromedriver不匹配問題解決辦法selenium.common.exceptions.SessionNotCreatedException

    chrome瀏覽器版本和Chromedriver不匹配問題解決辦法selenium.common.exceptions.SessionNotCreatedException

    執(zhí)行selenium抓取的時候,報下面錯誤: 這是因為瀏覽器的版本和Chromedriver的版本不匹配,Chrome瀏覽器如果沒有關(guān)閉自動更新,會一直出現(xiàn)這個問題,比較麻煩,建議關(guān)閉Chrome瀏覽器自動更新,參照另外一篇文章:Chrome瀏覽器關(guān)閉自動更新 谷歌鏡像版本下載鏈接:https://regist

    2024年02月16日
    瀏覽(25)
  • 已解決selenium.common.exceptions.SessionNotCreatedException: Message: session not created異常的正確解決方法,親測有效

    已解決selenium.common.exceptions.SessionNotCreatedException: Message: session not created異常的正確解決方法,親測有效!??! 文章目錄 問題分析 報錯原因 解決思路 解決方法 總結(jié) 在進行Web自動化測試或者網(wǎng)頁爬蟲開發(fā)時,Selenium是一個非常棒的工具。然而,在使用過程中,你可能會遇到以

    2024年02月19日
    瀏覽(22)
  • python 報 selenium.common.exceptions.SessionNotCreatedException

    今天做selenium項目更新,莫名其妙報了SessionNotCreatedException 錯誤,顯示錯誤如下: 顯示不是chromedriver與chrome版本不兼容問題。后面腦回路,終于知道原因。 之前可能安裝了其它包把selenium版本更新到了4.x.x。猜測這個版本對chrome版本有最低要求。經(jīng)過升級chrome版本與chromedriv

    2024年02月13日
    瀏覽(17)
  • 連接安卓模擬器報錯,selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not已解決

    連接安卓模擬器報錯,selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not已解決

    問題: 運行python代碼,遇到問題:selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: platformName, deviceName) 解決方法 前置條件:我是使用的appium Server命令行安裝 步驟1:卸載appium 運行

    2024年02月04日
    瀏覽(32)
  • selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception: Missi

    問題描述:selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception: Missing or invalid capabilities ? (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.18.0-348.7.1.el8_5.x86_64 x86_64) 版本問題:

    2024年02月11日
    瀏覽(16)
  • selenium.common.exceptions.SessionNotCreatedException瀏覽器版本不匹配報錯

    python自動控制Google瀏覽器時報錯: elenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 105 Current browser version is 107.0.5304.122 with binary path? 原因:Chrome與ChromeDriver版本不一致,瀏覽器版本不匹配 解決方法:查詢?yōu)g覽器對應(yīng)

    2024年02月11日
    瀏覽(21)
  • selenium啟動報錯:selenium.common.exceptions.SessionNotCreatedException: Message: session not created

    selenium啟動報錯:selenium.common.exceptions.SessionNotCreatedException: Message: session not created

    錯誤提示: selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 96 Current browser version is 102.0.5005.63 原因: Chrome版本和ChromeDriver版本不一致,極有可能是Chrome瀏覽器自動升級了新版本,導(dǎo)致兩者版本差異,運行不了。 解決

    2024年02月06日
    瀏覽(20)
  • selenium.common.SessionNotCreatedException Message session not created.ChromeDriver support ver解決方案

    selenium.common.SessionNotCreatedException Message session not created.ChromeDriver support ver解決方案

    ??大家好,我是愛編程的喵喵。雙985碩士畢業(yè),現(xiàn)擔(dān)任全棧工程師一職,從事機器學(xué)習(xí)以及相關(guān)的前后端開發(fā)工作。曾在阿里云、科大訊飛、CCF等比賽獲得多次Top名次。現(xiàn)為CSDN博客專家、人工智能領(lǐng)域優(yōu)質(zhì)創(chuàng)作者。 ??本文主要介紹了selenium.common.exceptions.SessionNotCreatedEx

    2024年02月14日
    瀏覽(17)
  • 解決selenium.common.exceptions.NoSuchElementException:的問題

    解決selenium.common.exceptions.NoSuchElementException:的問題

    1. 用selenium點擊某個按鈕,然后生成了一個新的標(biāo)簽頁(網(wǎng)頁)這個時候你去定位這個新的標(biāo)簽頁(網(wǎng)頁)里面的標(biāo)簽不管用你用什么去定位都定位不到,因為在你的視角瀏覽器會自動幫你跳轉(zhuǎn)到第二個標(biāo)簽頁,但是selenium它還在第一個標(biāo)簽頁,然后就變成了你寫你的不管se

    2024年02月16日
    瀏覽(30)
  • selenium報錯解決:selenium.common.exceptions.WebDriverException: Message(已解決)

    selenium報錯解決:selenium.common.exceptions.WebDriverException: Message(已解決)

    今天使用selenium遇到報錯: selenium.common.exceptions.WebDriverException: Message: Service ./windows/chromedriver.exe unexpectedly exited. Status code was: 1 報錯截圖: ? 檢查了代碼沒有發(fā)現(xiàn)問題,根據(jù)報錯初步判斷問題是出在chromedriver的路徑上面,對比之前的代碼 乍一看不能發(fā)現(xiàn)問題,仔細對比發(fā)現(xiàn)是

    2024年02月11日
    瀏覽(31)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包