rows = driver.find_elements_by_css_selector("table.aui tr")
for row in rows:
time.sleep(2)
projectNames = row.find_elements_by_xpath(".//td[1]")
for projectName in projectNames:
time.sleep(1)
print (projectName.text)
time.sleep(1)
最后,如果你的驱动程序很快就要关闭了,你应该进入WebDriverWait()命令。也许是这样的
from selenium.webdriver.support import expected_conditions as EC
row = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.xpath(".//td[1]"))
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Path") #Path to your chrome profile
w = webdriver.Chrome(executable_path="C:\\Path\\To\\chromedriver.exe", chrome_options=options)
为了给它一些时间来做事,我有几种方法来处理这个问题。你知道吗
一种是设置一个时间加载页面。你知道吗
也许我也会用时间。睡眠来自时间模块的命令
最后,如果你的驱动程序很快就要关闭了,你应该进入WebDriverWait()命令。也许是这样的
希望这有帮助!祝你好运
简单地说,看看加载你的chrome\u配置文件或你的浏览器配置文件的副本(无论你使用什么浏览器)不必重新登录后,第一次。你知道吗
https://www.youtube.com/watch?v=9UCaZT48Nnw
相关问题 更多 >
编程相关推荐