please someone can share working examples about desired_capabilities ?

832 views
Skip to first unread message

Andrea Bisello

unread,
Feb 23, 2016, 4:42:56 AM2/23/16
to robotframework-users
Hi,

after reading


in 3. we found :

${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

is this the right way to set capabilities? it doesn't looks robots framework style.

desired_capabilitie=${dc} 

should'nt be 

desired_capabilities=${dc}


thanks for every suggestion

Kevin O.

unread,
Feb 23, 2016, 10:58:50 AM2/23/16
to robotframework-users
Desired capabilities are not processed by Open Browser unless remote_url is populated. see https://github.com/robotframework/Selenium2Library/issues/139

You can use Create Webdriver instead.

Hrushikesh Deshmukh

unread,
Jul 30, 2019, 2:58:53 PM7/30/19
to robotframework-users
Hi,

I am unable to launch Internet explorer using Python Robot framework. Exception we are getting "SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones."

Due to company policy we are not supposed to modify Protected mode setting values in IE. 

I have already tried to add DesiredCapability for "ignoreProtectedModeSettings"  with value True for local or remote execution. But it doesnt seem to be working

Code used:

*** Keywords ***
Test Browser


    ${caps}=    Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.INTERNETEXPLORER    sys,selenium.webdriver
    Set To Dictionary    ${caps}    ignoreProtectedModeSettings    ${True}
    Create WebDriver    Ie    capabilities=${caps}    
    Goto    http://www.google.com 

Error after execution:
WebDriverException: Message: Desired Capabilities must be a dictionary   


Does anyone know solution to this problem?

Raju Penumatsa

unread,
Jul 30, 2019, 3:54:46 PM7/30/19
to hkesh.d...@gmail.com, robotframework-users
Hi, 

This is my code for chrome, 


${options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
Create Webdriver    Chrome    chrome_options=${options}

I Guess, In your case it should be 
${options}=    Evaluate    sys.modules['selenium.webdriver'].InternetexplorerOptions()    sys, selenium.webdriver


Raju 



--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/a5621d82-8abf-4d98-9ca5-5281124fa72d%40googlegroups.com.

susanta Kumar Patra

unread,
Jul 30, 2019, 4:29:49 PM7/30/19
to hkesh.d...@gmail.com, robotframework-users
Hi,

Try the following.

Open Browser      ${url_to_open}       browser=ie

For this you have to open internet Explorer and go to internet options
Security tab
Now for all the zones check "enable protection mode" Checkbox then save.

All zones are
    Internet
    Local Intranet
    Trusted Sites
    Restricted Sites

Hope this works.

Regards,
Susanta

--

Geist Eng

unread,
Aug 4, 2019, 4:29:20 PM8/4/19
to robotframe...@googlegroups.com
Here is another example I use:

Open Chrome Browser to Page
| | [Documentation]
| | ... | Opens Google Chrome to a given web page using Create Webdriver so
| | ... | arguments can be passed to webdriver in the form of capabilities.
| | ... | For more information on what capabilities that Google Chrome
| | ... | supports, see [http://chromedriver.chromium.org/capabilities] and
| | ... | [https://peter.sh/experiments/chromium-command-line-switches/]
| | ... |
| | ... | Webdriver can be run remotely using the selenium remote server.
| | ... | This can be done in 'Grid' mode with both a Hub server and
| | ... | Node servers where the tests are route to by the Hub to be run.
| | ... | See run_tests.sh for options to use this feature.
| | [Arguments] | ${url} |
| | ${ws}= | Set Variable | window-size=1080,1080 |
| | ${chrome_options}= | Evaluate | sys.modules['selenium.webdriver'].ChromeOptions() | sys |
| | Call Method | ${chrome_options} | add_argument | disable-infobars          |
| | Call Method | ${chrome_options} | add_argument | test-type                 |
| | Call Method | ${chrome_options} | add_argument | disable-extensions        |
| | Call Method | ${chrome_options} | add_argument | ignore-certificate-errors |
| | Call Method | ${chrome_options} | add_argument | allow-insecure-localhost  |
| | Call Method | ${chrome_options} | add_argument | disable-browser-side-navigation |
| | Call Method | ${chrome_options} | add_argument | ${ws} |
| | Run Keyword If | ${Use Chrome Headless} |
| | ... | Call Method | ${chrome_options} | add_argument | headless |
| | Run Keyword If | ${Use Selenium Server} |
| | ...        | Create Remote Chrome Webdriver | ${chrome_options} |
| | ... | ELSE | Create Local Chrome Webdriver  | ${chrome_options} |
| | Go To | ${url} |

Create Remote Chrome Webdriver
| | [Arguments] | ${chrome options} |
| | ${options}= |  Call Method |  ${chrome_options} | to_capabilities |
| | ${status} | ${resp}= | Run Keyword And Ignore Error |
| | ... | Create Webdriver | Remote | command_executor=${Selenium Server URL} | desired_capabilities=${options}
| | Run Keyword If | '${status}'=='FAIL' | Fail |
| | ... | Could not connect to Selenium Server.  Is it up?\nError: ${resp} |

Create Local Chrome Webdriver
| | [Arguments] | ${chrome options} |
| | ${status} | ${resp}= | Run Keyword And Ignore Error |
| | ... | Create Webdriver | Chrome | chrome_options=${chrome_options} |
| | Run Keyword If | '${status}'=='FAIL' | Fail |
| | ... | Could not start browser.  Are tests being run locally?\nError: ${resp} |




Pekka Klärck

unread,
Aug 5, 2019, 6:20:28 AM8/5/19
to geis...@gmail.com, robotframework-users
Hi,

have you tested enhanced Open Browser keyword in SelenlumLibrary 4.0?
It ought to make it possible to specify browser specific options
without needing to use `Evaluate` and `Call Method`. I'm sure Tatu
would be interested in hearing feedback. For example, converting your
example to use Open Browser would be very interesting.

Cheers,
.peke
> Create Local Chrome Webdriver
> | | [Arguments] | ${chrome options} |
> | | ${status} | ${resp}= | Run Keyword And Ignore Error |
> | | ... | Create Webdriver | Chrome | chrome_options=${chrome_options} |
> | | Run Keyword If | '${status}'=='FAIL' | Fail | Could not start browser. Are tests being run locally?\nError: ${resp} |
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "robotframework-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/522570f3-0c44-41dc-a755-8cec010d316c%40googlegroups.com.



--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

Barry

unread,
Aug 22, 2019, 2:46:31 PM8/22/19
to robotframework-users
Not sure where my issue is, but I've been running headlesschrome successfully, and now wanted to test something in Chrome Canary (on a Mac), so I added:

Call Method     ${c_opts}   add_argument    binary_location\=/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary

When I run one robot file, foo.robot, it works.  When I run a suite. ./, it fails with my command line parameter -v browser:headlesschromecanary

Suite setup failed:
ValueError: headlesschromecanary is not a supported browser.

What am I missing?  I was kinda half surprised that individual robot tests worked, since chromedriver is 76 to match public, and Canary is 78, and Chrome requires a driver update with each version.

Barry

Geist Eng

unread,
Aug 23, 2019, 1:03:44 PM8/23/19
to robotframework-users
No, not yet.  I move forward slowly on Selenium for stability reasons.  I tend to stay one or two releases  behind on Chrome and the Chromedriver unless reported issues on the users group show I should skip a release.  

But I will check out the enhancements when I move up.
> To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Pekka Klärck

unread,
Aug 23, 2019, 1:07:49 PM8/23/19
to geis...@gmail.com, robotframework-users
You can keep using same Selenium even if you upgrade SeleniumLibrary.

Sent from my mobile.

> To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/522570f3-0c44-41dc-a755-8cec010d316c%40googlegroups.com.



--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/bea3212d-61d1-49d6-95fa-9dbea42c1bee%40googlegroups.com.
Message has been deleted

Patrick Pugh

unread,
Apr 17, 2020, 9:55:17 AM4/17/20
to robotframework-users
Hi,

Here's an example of something I use to launch Edge

Start Browser - Edge
    [Documentation]  Because Edge doesn't work in private mode by default and it doesn't seem possible to programmatically clear the cookies.

    ${Capabilities}     Evaluate  {'ms:inPrivate':True, 'browserName': 'MicrosoftEdge', 'version': '', 'platform': 'WINDOWS'}
    Create Webdriver    Edge      capabilities=${Capabilities}
    Go To  about:blank  


From: robotframe...@googlegroups.com <robotframe...@googlegroups.com> on behalf of Sathish <sathi...@gmail.com>
Sent: April 16, 2020 18:05
To: robotframework-users <robotframe...@googlegroups.com>
Subject: Re: please someone can share working examples about desired_capabilities ?
 
Try this solution it worked for me, atleast got rid of zoom level problem:
${options} =  Evaluate  sys.modules['selenium.webdriver'].DesiredCapabilities.INTERNETEXPLORER  sys,selenium.webdriver
set to dictionary  ${options}  ignore_zoom_level=True  ignore_protected_mode_settings=True
open browser  about:blank  Ie  None  ${Remote_Hub_Url}  desired_capabilities=${Options}

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages