通过Robot Framework更改浏览器功能 [英] Change Browser Capabilities through Robot Framework

查看:352
本文介绍了通过Robot Framework更改浏览器功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有特权在本地更改IE设置.我写了一个Java代码来使用以下方法更改IEDriver的功能:

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);

我想在Robot Framework中使用Selenium Webdriver时做同样的事情.我想做这样的事情.但是我不知道正确的方法.

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

非常感谢!

推荐答案

DesiredCapabilities ,列出了可配置的属性.必需的属性是ignoreProtectedModeSettings,必须将其设置为True

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

这篇关于通过Robot Framework更改浏览器功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆