【发布时间】:2021-08-15 23:45:03
【问题描述】:
我有一个 Windows 10 64 位系统。
我下面的简单 selenium 代码运行时没有异常/错误,但会打开一个空白页面而不是打开 google.com,并且它与任何 url 的行为相同,不仅是 google.com:
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
#Chrome browser version 91.0.4472.77
# Crome-Driver version used: 91.0.4472.19 <--latest
url='https://www.google.co.in/'
driver_path='F:\Path\chromedriver_win32\chromedriver.exe'
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--ignore-ssl-errors')
#chrome_options.add_argument("--headless")
driver = webdriver.Chrome(executable_path= driver_path, options= chrome_options)
driver.get(url)
我得到的输出:
谁能告诉我,这是怎么回事?我以前写过 selenium 代码(虽然在不同的机器上),但从来没有遇到过这样的基本问题,也不知道如何解决它,因为代码根本没有报告错误。
我确实浏览了一些其他相关问题,但也没有看到任何答案/解决方案:
Selenium webdriver loads a blank page instead of the target URL
【问题讨论】:
-
@itronic1990 这确实有帮助。谢谢
标签: python-3.x selenium google-chrome selenium-webdriver selenium-chromedriver