对于firefox、chrome、safarim、edge,它的工作方式如下所示:
driver_instance = webdriver.Chrome(chrome_options=chrome_options)
但是我找不到关于如何为Opera web驱动程序做同样的事情的信息,显然它是受支持的。我下载了Opera webdriver,把它放在我的路径中,但是我应该运行什么命令来使它在Opera中运行呢?
发布于 2022-10-24 14:28:38
下载opera驱动程序:https://github.com/operasoftware/operachromiumdriver/releases
然后像这样使用:
options.binary_location = r'location_of_opera.exe'
self.driver = webdriver.Opera(options=options, executable_path=r'location_of_operadriver.exe')
示例:示例
发布于 2022-10-24 13:56:59
您可以使用下面的代码启动opera
浏览器
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.opera.options import Options
options = Options()
options.binary_location = r'location_of_opera.exe'
driver = webdriver.Opera(options=options, executable_path=r' location_of_operadriver.exe')
driver.maximize_window()
driver.get("https://www.google.com")
https://stackoverflow.com/questions/74182090
复制相似问题