我正在尝试为办公目的构建一个基本的网络自动化工具。 我已经遵循了一些指南,并且至少能够让脚本检测驱动程序并打开浏览器。
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")