TransWikia.com

AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'

Stack Overflow на русском Asked by flexo223 on November 20, 2021

Использую selenium + python. Установил selenium в python через pip и написал такой код :

from selenium import webdriver    
driver=webdriver.Chrome("E:driverschromedriver.exe")

При выполнении в Pycharm появвляется такой лог с ошибкой :

Traceback (most recent call last): 
File"C:/Users/user/PycharmProjects/untitled/bot.py", line 3, in <module> 
driver=webdriver.Chrome("E:driverschromedriver.exe") 
AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'

А при выполнении через IDLE :

Traceback (most recent call last):
File "C:UsersuserPycharmProjectsuntitledbot.py", line 3, in <module>
driver=webdriver.Chrome("E:driverschromedriver.exe")
File "E:pythonlibsite-packagesseleniumwebdriverchromewebdriver.py",     
line 75, in __init__desired_capabilities=desired_capabilities)
File "E:pythonlibsite-packagesseleniumwebdriverremotewebdriver.py",     
line 154, in __init__self.start_session(desired_capabilities, browser_profile)
File "E:pythonlibsite-packagesseleniumwebdriverremotewebdriver.py",     
line 243, in start_session response = self.execute(Command.NEW_SESSION, parameters)
File "E:pythonlibsite-packagesseleniumwebdriverremotewebdriver.py", 
line 312, in execute self.error_handler.check_response(response)
File "E:pythonlibsite-packagesseleniumwebdriverremoteerrorhandler.py", 
line 242, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: 
Message: unknown error: chrome failed to start (Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.3.9600 x86_64)`

Используется питон версии 3.6.4

One Answer

Нужно добавить seleneium в настройках venv Project Interpreter Selenium. Ctrl + Alt + S и добавьте его в списке. Скрин с настройками

Answered by Daria Antokhina on November 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP