【问题标题】:Change Browser to use No Proxy Capabilities through Robot Framework通过机器人框架更改浏览器以使用无代理功能
【发布时间】:2020-01-18 09:03:03
【问题描述】:

我想不使用代理启动我的 Firefox。
目前正在使用系统代理设置。

${chrome_options} =     Evaluate    sys.modules['selenium.webdriver'].FirefoxProfile()    sys, selenium.webdriver

Call Method    ${chrome_options}   set_preference    network.proxy.type    0

${options}   Call Method     ${chrome_options}    set_preference {"network.proxy.type", 0}

Open Browser    http://cnn.com    browser ff    desired_capabilities=${options}

有人可以帮我吗

【问题讨论】:

标签: python selenium selenium-webdriver automation robotframework


【解决方案1】:

这对我有用:

Start Firefox with no proxy
    ${proxy}=    Evaluate   sys.modules['selenium.webdriver'].Proxy()        sys, selenium.webdriver
    ${direct}=   Evaluate   sys.modules['selenium.webdriver'].common.proxy.ProxyType.DIRECT        sys, selenium.webdriver
    ${proxy.proxyType}=    Set Variable    ${direct}
    ${caps}=    Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.FIREFOX        sys, selenium.webdriver
    Evaluate    $proxy.add_to_capabilities($caps)
    Open Browser    http://google.com    Firefox

【讨论】:

    猜你喜欢
    • 2015-09-12
    • 2013-02-07
    • 2020-10-11
    • 2020-02-20
    • 2016-09-06
    • 2020-06-04
    • 2021-12-21
    • 1970-01-01
    • 2018-04-01
    相关资源
    最近更新 更多