我在文档中搜索了chrome webdriver的参数service_args
,我找到了以下页面:here和here,遗憾的是,它们不包含任何有用的内容来回答我的问题。
那么在哪里可以找到关于service_args
参数的适当文档?
答案 0 :(得分:2)
没有记录这一点的原因尚不清楚。
但很可能这个选项可用于将参数传递给chromedriver
。运行
chromedriver --help
对于chromdriver
的2.24版,您将获得以下列表:
Usage: chromedriver [OPTIONS]
Options
--port=PORT port to listen on
--adb-port=PORT adb server port
--log-path=FILE write server log to file instead of stderr, increases log level to INFO
--verbose log verbosely
--version print the version number and exit
--silent log nothing
--url-base base URL path prefix for commands, e.g. wd/url
--port-server address of server to contact for reserving a port
--whitelisted-ips comma-separated whitelist of remote IPv4 addresses which are allowed to connect to ChromeDriver
答案 1 :(得分:1)
service_args
二进制文件一起使用 chromedriver
来传递 List of args to the chromedriver service
一个例子是传递参数,例如日志文件路径,忽略ssl错误,任何ssl协议,如下所示:
service_args=["--log-path=D:\\Alex.log", "--ignore-ssl-errors=true", "--ssl-protocol=any"]
您的代码行将是:
driver = webdriver.Chrome(executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe', service_args=["--log-path=D:\\qc1.log", "--ignore-ssl-errors=true", "--ssl-protocol=any"])