在我对这个问题发表评论之前,我很清楚这可能是这个链接的重复,但提供的答案并没有帮助我解决我的代码实例,即使在应用了答案的调整版本之后我的代码。我已经查看了很多答案,包括将 Chromedriver 安装到我的设备中,但无济于事。
我的代码如下:
from selenium import webdriver
import time
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
options.binary_location = "/usr/bin/chromium"
driver = webdriver.Chrome(executable_path = r'C:\Users\user\Downloads\chromedriver_win32')
driver.get('http://codepad.org')
text_area = driver.find_element_by_id('textarea')
text_area.send_keys("This text is send using Python code.")
每次我运行代码时,包括executable_path = r'C:\Users\user\Downloads\chromedriver_win32'
当我使用可执行路径运行代码时,我都会不断收到权限错误消息。我没有路径的代码与executable_path
我替换的代码相同driver = webdriver.Chrome(options)
,但我收到错误消息argument of type 'Options' is not iterable
。
非常感谢您对此问题的任何帮助。诚然,我对 Python 和编码有点陌生,总的来说,我正在尝试新的想法来更好地学习这个程序,但是我试图找到答案的所有东西都会破坏我的代码。