Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Browser Capabilities through Robot Framework

I do not have privileges to change IE settings locally. I wrote a Java Code to change the capabilities of IEDriver using :

 DesiredCapabilities caps = DesiredCapabilities.internetExplorer();    caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        caps.setCapability(
                InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
                true);

I want to do the same thing while using the selenium webdriver in Robot Framework. I want to do something like this. But I do not know the right way to do it.

*** 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

Thanks a lot!

like image 370
Tazo Avatar asked Dec 24 '22 17:12

Tazo


1 Answers

In the Selenium documentation for DesiredCapabilities, the configurable properties are listed. The required property is ignoreProtectedModeSettings which must be set to 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
like image 90
David Avatar answered Dec 28 '22 06:12

David