ModuleNotFoundError:没有名为

我已经安装了 selenium pip install selenium,目前正在学习。但这发生了:


from selenium import webdriver

from selenium.webdriver.common.keys import Keys

from selenium.webdriver.common.by import By

from selenium.webdriver.common.support.ui import WebDriverWait

from selenium.webdriver.common.support import expected_conditions as EC

import time


PATH = "/Users/mattmac/Downloads/chromedriver"

driver = webdriver.Chrome(PATH)

Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'selenium.webdriver.common.support'


慕勒3428872
浏览 119回答 3
3回答

largeQ

刚刚测试了这个。好像support不需要从common. 尝试像这样导入:from selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC

米脂

试试下面的代码:from selenium import webdriverfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECimport timedriver = webdriver.Chrome(executable_path="chromedriver.exe")driver.get("Your URL")

翻阅古今

正如您想要导入的那样,WebDriverWait路径不是selenium.webdriver.common.support.uibut&nbsp;selenium.webdriver.support.ui。如此有效,您需要更换该行:from&nbsp;selenium.webdriver.common.support.ui&nbsp;import&nbsp;WebDriverWait和:from&nbsp;selenium.webdriver.support.ui&nbsp;import&nbsp;WebDriverWait类似于导入expected_conditions路径 isn't&nbsp;selenium.webdriver.common.supportbut&nbsp;selenium.webdriver.support import。如此有效,您需要更换该行:from&nbsp;selenium.webdriver.common.support&nbsp;import&nbsp;expected_conditions&nbsp;as&nbsp;EC和:from&nbsp;selenium.webdriver.support&nbsp;import&nbsp;expected_conditions&nbsp;as&nbsp;EC
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python