我没有权限在本地更改IE设置。我编写了一个Java代码来改变IEDriver的功能:
DesiredCapabilities caps = DesiredCapabilities.internetExplorer(); caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
caps.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true);
我想在Robot Framework中使用selenium webdriver时做同样的事情。我想做这样的事情。但我不知道正确的做法。
*** Keywords ***
Test Browser
${options}= Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.INTERNETEXPLORER sys,selenium.webdriver
Call Method ${options} add_argument INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS:True
Create WebDriver Internet Explorer ie_options=${options}
Open Browser To Login Page
Open Browser ${LOGIN URL} ${BROWSER}
Maximize Browser Window
Set Selenium Speed ${DELAY}
Login Page Should Be Open
非常感谢!
在DesiredCapabilities的Selenium文档中,列出了可配置属性。必需属性是ignoreProtectedModeSettings,必须设置为True
${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.INTERNETEXPLORER sys, selenium.webdriver
Set To Dictionary ${dc} ignoreProtectedModeSettings ${True}
Open Browser www.google.com ie desired_capabilitie=${dc}
${s2l}= Get Library Instance Selenium2Library
Log Dictionary ${s2l._current_browser().capabilities} # actual capabilities
对于任何来到这里寻找机器人框架内的this problem解决方案的人:
Set Chrome Desired Capabilities
[Documentation] Create the desired capabilities object with which to instantiate the Chrome browser.
${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys, selenium.webdriver
${experimental_options} Create Dictionary useAutomationExtension ${False}
Set To Dictionary ${dc} chromeOptions ${experimental_options}
Set Global Variable ${DESIRED_CAPABILITIES} ${dc}