您好,我正在尝试使用python安装带有Selenium的Chrome扩展,我尝试使用ChromeDriver - WebDriver for Chrome
但它不起作用,这是我的代码:
from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import ChromeOptions
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.expected_conditions import presence_of_element_located
import re # regular expressions, are imported from python directly
import time
import numpy as np
import pandas as pd
import functions_database
# Pandas read CSV
df_read = pd.read_csv(
'/home/daniel/amazon-project-scrapers/ss_scraper.edited2.csv')
amazon_data = list(df_read.amz_search)
# Chrome Driver + install plugin
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/home/daniel/amazon-project-scrapers/chromedriver_linux64/DS-Amazon-Quick-View_v2.8.9.crx"));
ChromeDriver driver = new ChromeDriver(options);
driver = webdriver.Chrome(executable_path='/home/daniel/amazon-project-scrapers/chromedriver_linux64/chromedriver')
driver.get('https://www.amazon.com/')
这就是我得到的错误:
File "camel_scraper.py", line 23
ChromeOptions options = new ChromeOptions();
^
SyntaxError: invalid syntax
我试着用其他3种不同的方法来做这件事,实际上在堆栈溢出中有一个类似的问题,它的答案是不推荐的,如果我再次找到它,我会在这里写下链接
要使用Selenium的python客户端添加/安装
DS-Amazon-Quick-View
Chrome扩展,您可以使用以下解决方案:代码块:
参考文献
您可以在以下内容中找到一些相关讨论:
相关问题 更多 >
编程相关推荐