最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python3+selenium配置常見(jiàn)報(bào)錯(cuò)解決方案

 更新時(shí)間:2020年08月28日 10:39:12   作者:羅維翩  
這篇文章主要介紹了Python3+selenium配置常見(jiàn)報(bào)錯(cuò)解決方案,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下

第一個(gè)坑:'geckodriver' executable needs to be in PATH

1.如果啟動(dòng)瀏覽器過(guò)程中報(bào)如下錯(cuò)誤

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\test\python3\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 145, in __init__
self.service.start()
File "D:\test\python3\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

2.這個(gè)是因?yàn)樽钚碌膕elenium3.0啟動(dòng)firefox需要geckodriver.exe這個(gè)驅(qū)動(dòng)文件。

3.下載之后,配置到環(huán)境變量path下(可以直接放python根目錄)

第二坑:Expected browser binary location, but unable to find binary in default location

1.如果啟動(dòng)瀏覽器過(guò)程中報(bào)如下錯(cuò)誤:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\test\python3\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 155, in __init__
keep_alive=True)
File "D:\test\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)

File "D:\test\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "D:\test\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 238, in execute
self.error_handler.check_response(response)
File "D:\test\python3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location,
no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line.

2.這個(gè)是因?yàn)閒irefox.exe這個(gè)文件也需要配置到環(huán)境變量path下。

3.這個(gè)路徑就是安裝完firefox后,找到firefox.exe這個(gè)文件的地址,加到path下。

第三坑:Unsupported Marionette protocol version 2, required 3

1.如果啟動(dòng)瀏覽器過(guò)程中出現(xiàn)如下錯(cuò)誤

Traceback (most recent call last):
File "<stdin>", line 1, in <module>

File "D:\test\python3\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 155, in __init__
keep_alive=True)
File "D:\test\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "D:\test\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "D:\test\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 238, in execute
self.error_handler.check_response(response)
File "D:\test\python3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unsupported Marionette protocol version 2, required 3

2.這個(gè)錯(cuò)誤原因是firefox版本過(guò)低了,最新的selenium3.0版本支持firefox47以上的版本,升級(jí)版本就可以了

第四坑:WebDriverException: Message: newSession

1.Traceback (most recent call last):

File “D:\test\python3\lib\site-packages\selenium\webdriver\firefox\\webdriver.py”, line 170, in init
keep_alive=True)
File “D:\test\python3\lib\site-packages\selenium\webdriver\firefox\\webdriver.py”, line 156, in init
self.start_session(capabilities, browser_profile)
File “D:\test\python3\lib\site-packages\selenium\webdriver\firefox\\webdriver.py”, line 245, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File “D:\test\python3\lib\site-packages\selenium\webdriver\firefox\\webdriver.py”, line 314, in execute
self.error_handler.check_response(response)
File “D:\test\python3\lib\site-packages\selenium\webdriver\firefox\\errorhandler.py”, line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: newSession

2.下載最新的geckodriver.exe 然后把它放到python的安裝目錄下

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 入門tensorflow教程之TensorBoard可視化模型訓(xùn)練

    入門tensorflow教程之TensorBoard可視化模型訓(xùn)練

    在本篇文章中,主要介紹 了TensorBoard 的基礎(chǔ)知識(shí),并了解如何可視化訓(xùn)練模型中的一些基本信息,希望對(duì)大家的TensorBoard可視化模型訓(xùn)練有所幫助
    2021-08-08
  • Linux上Miniconda的安裝的實(shí)現(xiàn)步驟

    Linux上Miniconda的安裝的實(shí)現(xiàn)步驟

    Miniconda是一個(gè)輕量級(jí)、免費(fèi)且開(kāi)源的跨平臺(tái)軟件包管理系統(tǒng),本文主要介紹了Linux上Miniconda的安裝的實(shí)現(xiàn)步驟,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-03-03
  • 基于Python實(shí)現(xiàn)定時(shí)自動(dòng)給微信好友發(fā)送天氣預(yù)報(bào)

    基于Python實(shí)現(xiàn)定時(shí)自動(dòng)給微信好友發(fā)送天氣預(yù)報(bào)

    這篇文章主要介紹了基于Python實(shí)現(xiàn)定時(shí)自動(dòng)給微信好友發(fā)送天氣預(yù)報(bào)的實(shí)現(xiàn)代碼,,需要的朋友可以參考下
    2018-10-10
  • Python+Selenium定位不到元素常見(jiàn)原因及解決辦法(報(bào):NoSuchElementException)

    Python+Selenium定位不到元素常見(jiàn)原因及解決辦法(報(bào):NoSuchElementException)

    這篇文章主要介紹了Python+Selenium定位不到元素常見(jiàn)原因及解決辦法(報(bào):NoSuchElementException),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • python操作xml文件詳細(xì)介紹

    python操作xml文件詳細(xì)介紹

    這篇文章主要介紹了python操作xml文件詳細(xì)介紹,著重介紹了獲取XML標(biāo)簽的屬性和值的方法,需要的朋友可以參考下
    2014-06-06
  • Django URL和View的關(guān)系說(shuō)明

    Django URL和View的關(guān)系說(shuō)明

    這篇文章主要介紹了Django URL和View的關(guān)系說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-03-03
  • 關(guān)于Python中的 oct 函數(shù)與 min 函數(shù)

    關(guān)于Python中的 oct 函數(shù)與 min 函數(shù)

    本文主要介紹了Python oct 函數(shù)與 min 函數(shù);oct 函數(shù)是 Python 內(nèi)置函數(shù),主要將一個(gè)整數(shù)轉(zhuǎn)為八進(jìn)制,與 ord 函數(shù) / chr 函數(shù) 有點(diǎn)類似;min 函數(shù)返回給定參數(shù)的最小值,參數(shù)可以為序列語(yǔ)法,感興趣的小伙伴請(qǐng)繼續(xù)閱讀下文
    2021-09-09
  • python中@符號(hào)實(shí)例詳解

    python中@符號(hào)實(shí)例詳解

    @是一個(gè)裝飾器,針對(duì)函數(shù),起調(diào)用傳參的作用,下面這篇文章主要給大家介紹了關(guān)于python中@符號(hào)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-12-12
  • 使用python和opencv的mask實(shí)現(xiàn)摳圖疊加

    使用python和opencv的mask實(shí)現(xiàn)摳圖疊加

    這篇文章主要介紹了使用python和opencv的mask實(shí)現(xiàn)摳圖疊加操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-04-04
  • 詳解如何使用Pandas刪除DataFrame中的非數(shù)字類型數(shù)據(jù)

    詳解如何使用Pandas刪除DataFrame中的非數(shù)字類型數(shù)據(jù)

    在數(shù)據(jù)處理和分析過(guò)程中,經(jīng)常會(huì)遇到需要清洗數(shù)據(jù)的情況,本文將詳細(xì)介紹如何使用Pandas刪除DataFrame中的非數(shù)字類型數(shù)據(jù),感興趣的小伙伴可以了解下
    2024-03-03

最新評(píng)論

温州市| 朝阳区| 临邑县| 阿克| 嘉义县| 拉萨市| 东辽县| 武隆县| 陆川县| 上饶县| 离岛区| 巨野县| 错那县| 渭源县| 无极县| 林甸县| 肇东市| 宝兴县| 万州区| 禹城市| 固原市| 乌拉特前旗| 白水县| 启东市| 罗定市| 彭州市| 金华市| 泗阳县| 左贡县| 双牌县| 开封县| 关岭| 徐水县| 新绛县| 乌兰县| 萨迦县| 富锦市| 信阳市| 鄂尔多斯市| 三河市| 灌南县|