这个问题是关于使用网络驱动程序(“ChromeDriver”,Selenium)来:
1) Look-up a .csv file; and
2) Visit all links in the file, one at a time, until the list is over.
我编写了一个简单的代码:
from selenium import webdriver
import time
import csv
driver = webdriver.Chrome()
假设link.csv包含以下站点:
• www.google.com
• www.wikipedia.org
• www.yahoo.com
f = open('link.csv', 'r', encoding='utf-8')
reader = csv.reader(f)
for line in reader:
driver.get(line[0])
time.sleep(10)
f.close()
...提出了以下消息:
"selenium.common.exceptions.InvalidArgumentException: Message: invalid argument"
感谢您在解释实际问题时的帮助和耐心:)
最佳答案
不要将索引与行一起使用,只需这样做:
for line in reader:
Driver.get(line)
关于Python > Selenium + CSV : Webdriver to read, 访问 .csv 文件中的所有链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59519210/