5

時異常這裏是我打開的Chrome代碼:Python的硒webdriver的 「會話沒有創建」 打開瀏覽器

Traceback (most recent call last): 
    File "C:/Users/Imran/PycharmProjects/webscrapping/WF Item.py", line 6, in <module> 
    driver = webdriver.Chrome('C:\\Users\\Imran\\AppData\\Local\\Programs\\Python\\Python36\\selenium\\chromedriver.exe') 
    File "C:\Users\Imran\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__ 
    desired_capabilities=desired_capabilities) 
    File "C:\Users\Imran\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__ 
    self.start_session(desired_capabilities, browser_profile) 
    File "C:\Users\Imran\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session 
    response = self.execute(Command.NEW_SESSION, capabilities) 
    File "C:\Users\Imran\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute 
    self.error_handler.check_response(response) 
    File "C:\Users\Imran\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response 
    raise exception_class(message, screen, stacktrace) 
selenium.common.exceptions.WebDriverException: Message: session not created exception 
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"27028.1","isDefault":true},"id":1,"name":"","origin":"://"} 
    (Session info: chrome=54.0.2840.71) 
    (Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 6.3.9600 x86_64) 

收到以下異常:在運行程序時

from selenium import webdriver 
driver=webdriver.Chrome('C:\\Users\\Imran\\AppData\\Local\\Programs\\Python\\Python36\\selenium\\chromedriver.exe') 

錯誤

selenium.common.exceptions.WebDriverException: Message: session not created exception 
+0

您是否找到解決方案? –

回答

12

更新你chromedriver到2.24版本n在這裏: http://chromedriver.storage.googleapis.com/index.html?path=2.24/

這對我來說

+0

我無法真正瞭解我們如何更新chromedriver?我在[〜/ anaconda/bin] =>中有一個[chromedriver],是否應該下載,解壓並用新解壓縮的[chromedriver]文件替換[chromedriver]文件? –

+0

謝謝soooooooooooooo親愛的弟弟 –

+0

我使用apt-get的方式來安裝/更新我的linux sysyem –

0

在Windows上安裝,下載chromedriver並解壓chromedriver_win32.zip和路徑添加到包含在環境變量設置chromedriver.exe的文件夾[系統屬性 - 高級系統設置 - 環境變量]。

相關問題