【问题标题】:Selenium Webdriver issue with python [duplicate]python的Selenium Webdriver问题[重复]
【发布时间】:2022-01-24 06:19:05
【问题描述】:

我有这个代码:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
print("Sample test initiated")
#driver selection
driver = webdriver.chrome(r"/Users/ananyarai/Downloads/chromedriver.exe")

它会导致以下错误:

"/Users/ananyarai/PycharmProjects/pythonProject1/venv/bin/python "/Users/ananyarai/PycharmProjects/pythonProject1/Demo /Sample 2.py"
Traceback (most recent call last):
  File "/Users/ananyarai/PycharmProjects/pythonProject1/Demo /Sample 2.py", line 7, in <module>
    driver = webdriver.chrome(r"/Users/ananyarai/Downloads/chromedriver.exe")
TypeError: 'module' object is not callable"
Sample test initiated

【问题讨论】:

标签: python selenium selenium-webdriver


【解决方案1】:

我认为你在这里拼错了这部分 driver = webdriver.chrome(r"/Users/ananyarai/Downloads/chromedriver.exe")

使用driver = webdriver.Chrome('C:\\path to \\chromedriver.exe')之类的东西可以获得想要的结果。

【讨论】:

    猜你喜欢
    • 2017-07-17
    • 1970-01-01
    • 2019-11-15
    • 1970-01-01
    • 2021-04-11
    • 2019-04-27
    • 2011-12-14
    • 2011-12-25
    • 1970-01-01
    相关资源
    最近更新 更多