因此,我一直在尝试使用selenium启动一个opera浏览器,但这相当复杂。
首先,它找不到路径,这很难,但我找到了一些与此相关的东西:
from selenium import webdriver
driver=webdriver.Opera(executable_path=r'D:\Prog\Opera\operadriver_win64\operadriver.exe')
driver.get("https://www.google.com/")
然后,我遇到了另一个问题,我得到了这个:
SessionNotCreatedException: session not created: This version of OperaDriver only supports Opera version 80
(Driver info: operadriver=80.0.3987.100 (3f00c26d457663a424865bbef1179f72eec1b9fe-refs/branch-heads/3987@{#864}),platform=Windows NT 10.0.18362 x86_64)`
因此,我尝试添加模块webdriver-manager来纠正此错误,但它不起作用。下面是我的代码:
from selenium import webdriver
from webdriver_manager.opera import OperaDriverManager
driver = webdriver.Opera(executable_path=OperaDriverManager().install()) # this line was supposed to correct the problem but it doesn't
driver.get("https://www.google.com/")
我在互联网上做了一些研究,很多事情都是关于operadriver和浏览器版本的,所以我的Opera浏览器版本是最后一个版本(71.0.3770.198),spyder告诉我这个驱动程序只支持opera版本80,但我不认为它存在。我这里有一个歌剧驱动程序:https://github.com/operasoftware/operachromiumdriver/releases,它说它应该适用于我的版本,所以我有点不明白
发布于 2020-10-02 18:25:26
您需要下载最新的驱动程序,版本为85.0.4183.102,目标是Opera稳定版71。
Opera基于Chromium,其最新版本是85。Opera webdriver名称与Chromium版本匹配。用于每个驱动程序的Opera版本的release page explains。您下载的驱动程序太旧,目标是Opera稳定版67。
https://stackoverflow.com/questions/64169889
复制相似问题