Release image version 1.12.2
[testsuite.git] / robot / resources / browser_setup.robot
1 *** Settings ***
2 Documentation     The main interface for interacting with VID. It handles low level stuff like managing the selenium request library and VID required steps
3 Library           Collections
4 Library           OperatingSystem
5 Library           SeleniumLibrary
6 Resource          global_properties.robot
7
8 *** Variables ***
9 ${HEADLESS}   True
10
11 *** Keywords ***
12 Setup Browser
13     [Documentation]   Sets up browser based upon the value of ${GLOBAL_SELENIUM_BROWSER}
14     Run Keyword If    '${GLOBAL_SELENIUM_BROWSER}' == 'firefox'    Setup Browser Firefox
15     Run Keyword If    '${GLOBAL_SELENIUM_BROWSER}' == 'chrome'    Setup Browser Chrome
16     Log    Running with ${GLOBAL_SELENIUM_BROWSER}
17
18 Setup Browser Firefox
19     ${caps}=   Evaluate   sys.modules['selenium.webdriver'].common.desired_capabilities.DesiredCapabilities.FIREFOX   sys
20     Set To Dictionary   ${caps}   marionette=
21     Set To Dictionary   ${caps}   elementScrollBehavior    1
22     ${wd}=   Create WebDriver   Firefox   capabilities=${caps}
23     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${caps}
24
25
26 Setup Browser Chrome
27     ${chrome options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys
28     Call Method    ${chrome options}    add_argument    no-sandbox
29     Call Method    ${chrome options}    add_argument    ignore-certificate-errors
30     Run Keyword If  ${HEADLESS}==True  Call Method    ${chrome options}    add_argument    headless
31     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME  sys, selenium.webdriver
32     Set To Dictionary   ${dc}   elementScrollBehavior    1
33     Set To Dictionary   ${dc}   ACCEPT_SSL_CERTS    True
34     Create Webdriver    Chrome   chrome_options=${chrome_options}    desired_capabilities=${dc}
35     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}
36
37
38
39
40 Handle Proxy Warning
41     [Documentation]    Handle Intermediate Warnings from Proxies
42     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    ${GLOBAL_PROXY_WARNING_TITLE}
43     Return From Keyword if    '${status}' != 'PASS'
44     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    ${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}
45     Return From Keyword if    '${status}' != 'PASS'
46     Return From Keyword if    "${GLOBAL_PROXY_WARNING_TITLE}" == ''
47     Return From Keyword if    "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == ''
48     ${test}    ${value}=    Run keyword and ignore error    Title Should Be     ${GLOBAL_PROXY_WARNING_TITLE}
49     Run keyword If    '${test}' == 'PASS'    Click Element    xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}