onap on kubernetes source files
[oom.git] / kubernetes / config / docker / init / src / config / robot / 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           OSUtils
5 Library           OperatingSystem
6 Library           ExtendedSelenium2Library
7 Resource          global_properties.robot
8
9 *** Variables ***
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     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.FIREFOX  sys, selenium.webdriver
20     Set To Dictionary   ${dc}   elementScrollBehavior    1 
21     Create Webdriver    Firefox    desired_capabilities=${dc}
22     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}
23            
24  Setup Browser Chrome
25     ${os}=   Get Normalized Os 
26     Log    Normalized OS=${os}
27     ${chrome options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys
28     Call Method    ${chrome options}    add_argument    no-sandbox
29     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME  sys, selenium.webdriver
30     Set To Dictionary   ${dc}   elementScrollBehavior    1
31     Create Webdriver    Chrome   chrome_options=${chrome_options}    desired_capabilities=${dc}  
32     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}       
33
34 Handle Proxy Warning    
35     [Documentation]    Handle Intermediate Warnings from Proxies
36     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    \${GLOBAL_PROXY_WARNING_TITLE}           
37     Return From Keyword if    '${status}' != 'PASS'
38     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}          
39     Return From Keyword if    '${status}' != 'PASS'
40     Return From Keyword if    "${GLOBAL_PROXY_WARNING_TITLE}" == ''
41     Return From Keyword if    "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == ''
42     ${test}    ${value}=    Run keyword and ignore error    Title Should Be     ${GLOBAL_PROXY_WARNING_TITLE}
43     Run keyword If    '${test}' == 'PASS'    Click Element    xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}