Compare commits
No commits in common. "cd16467312bcda01d607f2ba0c6617ee4e8e5e3c" and "51b18c6721215cfdc239cd8c0c1e573c5c6cce26" have entirely different histories.
cd16467312
...
51b18c6721
@ -64,24 +64,6 @@ port = config.get('WebSocket', 'port')
|
|||||||
sio.connect("ws://"+host+":"+port)
|
sio.connect("ws://"+host+":"+port)
|
||||||
# WebDriver初始化
|
# WebDriver初始化
|
||||||
def init_webdriver(driver_type):
|
def init_webdriver(driver_type):
|
||||||
# 先检查是否配置了自行安装的驱动
|
|
||||||
|
|
||||||
try:
|
|
||||||
if driver_type.lower() == "edge" and driver_path_edge: # 只有在Edge类型且路径已知的情况下才尝试使用已存在的驱动
|
|
||||||
edge_options = Options() # 创建Edge的Options实例
|
|
||||||
service = Service(executable_path=driver_path_edge) # 使用已知的驱动路径
|
|
||||||
driver = webdriver.Edge(service=service, options=edge_options) # 传入Options实例
|
|
||||||
logging.info("使用自行安装的Edge")
|
|
||||||
return driver
|
|
||||||
elif driver_path_chrome:
|
|
||||||
edge_options = Options() # 创建Edge的Options实例
|
|
||||||
service = Service(executable_path=driver_path_chrome) # 使用已知的驱动路径
|
|
||||||
driver = webdriver.Edge(service=service, options=edge_options) # 传入Options实例
|
|
||||||
logging.info("使用自行安装的Chrome")
|
|
||||||
return driver
|
|
||||||
except Exception as e:
|
|
||||||
logging.info("使用本地驱动失败,请先配置本地驱动。"+e.args[0])
|
|
||||||
|
|
||||||
options = Options()
|
options = Options()
|
||||||
manager = {
|
manager = {
|
||||||
"firefox": GeckoDriverManager,
|
"firefox": GeckoDriverManager,
|
||||||
|
Loading…
Reference in New Issue
Block a user