Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 正在尝试加载安装了扩展的chrome webdriver,_Python_Selenium_Selenium Webdriver - Fatal编程技术网

Python 正在尝试加载安装了扩展的chrome webdriver,

Python 正在尝试加载安装了扩展的chrome webdriver,,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我正在尝试加载已安装扩展的chrome webdriver(按照“”中提到的步骤),但找不到已安装的扩展。请您帮助我,我正在尝试的代码是 from selenium import webdriver from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_extension('C:/Users/john/Desktop/john/v1.10.0.0.cr

我正在尝试加载已安装扩展的chrome webdriver(按照“”中提到的步骤),但找不到已安装的扩展。请您帮助我,我正在尝试的代码是

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_extension('C:/Users/john/Desktop/john/v1.10.0.0.crx')
driver = webdriver.Chrome()
driver.get('https://www.google.co.in')
它只是启动并打开带有google页面的chrome webdriver,我正在尝试使用安装了扩展的浏览器打开。这是否可能使用selenium,有人能帮我打电话吗

driver = webdriver.Chrome(chrome_options=chrome_options)
而不仅仅是

driver = webdriver.Chrome()

我可以为您提供用java编写的代码,它运行良好

File file = new File("path_to_your_extension");

String path = file.getAbsolutePath();

ChromeOptions options = new ChromeOptions();

options.addExtensions(new File(path))

WebDriver driver = new ChromeDriver(options);

driver.get("https://www.google.co.in")