尝试使用 Selenium 创建网络自动工具,但网站无法加载
Trying to create web automatic tool with Selenium, however the website won't load
我正在尝试构建一个用于办公目的的基本 Web 自动化工具。
我遵循了一些指南,并且至少能够获取脚本来检测驱动程序并打开浏览器。
from selenium import webdriver
driver = webdriver.Chrome('/home/ava/Webautomator/chromedriver') #filepath of the driver
driver.get("www.google.com")
但是,在尝试加载 'google.com' 时出现以下错误:
Traceback (most recent call last):
File "webautomator2.py", line 4, in <module>
driver.get("www.google.com")
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
(Session info: chrome=80.0.3987.87)
有人知道如何解决这个错误吗?
只需更改此
driver.get("www.google.com")
对此
driver.get("https://www.google.com")
我正在尝试构建一个用于办公目的的基本 Web 自动化工具。 我遵循了一些指南,并且至少能够获取脚本来检测驱动程序并打开浏览器。
from selenium import webdriver
driver = webdriver.Chrome('/home/ava/Webautomator/chromedriver') #filepath of the driver
driver.get("www.google.com")
但是,在尝试加载 'google.com' 时出现以下错误:
Traceback (most recent call last):
File "webautomator2.py", line 4, in <module>
driver.get("www.google.com")
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
(Session info: chrome=80.0.3987.87)
有人知道如何解决这个错误吗?
只需更改此
driver.get("www.google.com")
对此
driver.get("https://www.google.com")