【问题标题】:What are 'service_args' for the selenium-python chrome webdriver?selenium-python chrome webdriver 的“service_args”是什么?
【发布时间】:2017-11-14 10:30:31
【问题描述】:

我在文档中搜索了 chrome webdriver 的参数 service_args,并找到了以下页面:herehere,遗憾的是它们不包含任何有用的内容来回答我的问题。

那么我在哪里可以找到关于 service_args 参数的正确文档?

【问题讨论】:

    标签: python selenium google-chrome selenium-chromedriver


    【解决方案1】:

    service_argschromedriver 二进制结合使用以传递 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"])
    

    【讨论】:

    • 但问题仍然存在:为什么没有正确记录...?
    【解决方案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
    

    【讨论】:

    • 我尝试了 --silent 但仍然在命令行中显示一些次要日志。 :(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-24
    • 1970-01-01
    • 2021-05-27
    • 2017-07-17
    • 2011-07-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多