关于python:如何更改Internet Explorer驱动selenium的解压路径

How to change the extract path for Internet explorer driver selenium

如何使用python设置提取路径

"指定用于提取服务器使用的支持文件的目录的完整路径。如果未指定,则默认为 TEMP 目录。"

https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver 显示有一个命令行开关可让您更改设置。我在python上尝试了几种方法,但仍然无法更改提取路径。


似乎这在最新的 python 绑定中不可用。但是你可以给它打补丁来支持相同的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
from selenium import webdriver

from selenium.webdriver.ie.service import Service

orig_command_line_args = Service.command_line_args


def patch_command_line_args(self):
    args = orig_command_line_args(self)
    return args + ["--extract-path=/tmp"]

Service.command_line_args = patch_command_line_args

driver = webdriver.Ie()