Selenium Chromedriver推出Chrome,但不打开网站(新的Chromedriver,同样的老问题) [英] Selenium Chromedriver launches Chrome, but doesn't open website (new Chromedriver, same old issue)
问题描述
我在使用Windows 7上的Selenium Chromedriver时遇到了麻烦。为了显示这个问题,我将它简化为一个简单的脚本,以启动纽约时报网站:
from selenium import webdriver
#--LOCATIONS -
#Chrome应用程序:
#C:\程序文件(x86)\Google\Chrome\Application\chrome.exe
#Chrome二进制文件:
#C:\Python27\Scripts\chromedriver.exe
chromedriver_path =C:\Python27\Scripts\chromedriver.exe
driver = webdriver.Chrome(executable_path = chromedriver_path)
driver.get(' https://www.nytimes.com/')
Chrome浏览器启动(让我推测Chrome应用程序路径没有任何内容),但不会进入NYT网站,会发生以下情况:
字符串 data:,
出现在URL地址栏中,并出现2个警报通知:一个表示您正在使用不支持的命令行标志:--ignore-certificate-errors。稳定性和安全性将受到影响。另一个表示禁用开发人员模式扩展:以开发人员模式运行的扩展可能会损害您的计算机。如果您不是开发人员,则应该禁用在开发人员模式下运行的这些扩展以保持安全。
当我使用Selenium for Firefox时没有发生这种情况我不确定如何处理Chrome,我已经尝试过在互联网上预先处理这个问题,但所有问题/解决方案都是从几年前(2014-2015)开始的,我相信Selenium包和
有人知道如何让我的代码正常工作吗?谢谢您。
这实际上只是一个IT经验法则;如果您排除了您意识到的其他任何问题,那么这是一个很好的机会问题是你没有意识到的。从方块1开始并重新安装Chromedriver。
I am having trouble using Selenium Chromedriver on Windows 7. To display the problem, I've boiled it down to a simple script to simply launch the New York Times website:
from selenium import webdriver
# --LOCATIONS --
# The Chrome app:
# C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
# The Chrome binary:
# C:\Python27\Scripts\chromedriver.exe
chromedriver_path = "C:\Python27\Scripts\chromedriver.exe"
driver = webdriver.Chrome(executable_path=chromedriver_path)
driver.get('https://www.nytimes.com/')
The Chrome Browser launches (leading me to speculate that there's nothing with the Chrome application path), but rather than going to the NYT website, the following happens:
The string data:,
appears in the URL address bar, and 2 alert notifications come up: one that says "You are using an unsupported command-line flag: --ignore-certificate-errors. Stability and security will suffer." and another that says "Disable developer mode extensions: Extensions running in developer mode can harm your computer. If you're not a developer, you should disable these extensions running in developer mode to stay safe."
This didn't happen when I used Selenium for Firefox- so I'm not sure what to do with Chrome. I've tried looking this issue up on the internet beforehand, but all the issues/solutions are dated from a few years back (2014-2015), and I believe the Selenium packages and Chromedriver binaries have been updated since then.
Does anyone know how I can get my code working? Thank you in advance.
I'd have to see your computer to examine how Chromedriver is installed, but as that's not quite feasible, I would at least recommend uninstalling any chromedriver executables on your computer and then downloading it into your project's directory.
It's really just an IT rule-of-thumb; if you've ruled out every other issue that you're aware of, then there's a good chance the problem is something you're not recognizing. Start at square 1 and reinstall Chromedriver.
这篇关于Selenium Chromedriver推出Chrome,但不打开网站(新的Chromedriver,同样的老问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!