3 回答
TA贡献2039条经验 获得超7个赞
刚刚测试了这个。好像support不需要从common. 尝试像这样导入:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
TA贡献1836条经验 获得超3个赞
试试下面的代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
driver = webdriver.Chrome(executable_path="chromedriver.exe")
driver.get("Your URL")
TA贡献1780条经验 获得超5个赞
正如您想要导入的那样,WebDriverWait
路径不是selenium.webdriver.common.support.ui
but selenium.webdriver.support.ui
。如此有效,您需要更换该行:
from selenium.webdriver.common.support.ui import WebDriverWait
和:
from selenium.webdriver.support.ui import WebDriverWait
类似于导入expected_conditions
路径 isn't selenium.webdriver.common.support
but selenium.webdriver.support import
。如此有效,您需要更换该行:
from selenium.webdriver.common.support import expected_conditions as EC
和:
from selenium.webdriver.support import expected_conditions as EC
添加回答
举报