blob: 5d34d3de41e17d2a563a39251e16fe0d868e6164 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation The main interface for interacting with VID. It handles low level stuff like managing the selenium request library and VID required steps
3Library Collections
4Library OSUtils
5Library OperatingSystem
6Library ExtendedSelenium2Library
7Resource global_properties.robot
8
9*** Variables ***
Jerry Flood71b7b0f2017-10-02 16:25:06 -040010${HEADLESS} True
DR695Hccff30b2017-02-17 18:44:24 -050011
12*** Keywords ***
13Setup Browser
14 [Documentation] Sets up browser based upon the value of ${GLOBAL_SELENIUM_BROWSER}
15 Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'firefox' Setup Browser Firefox
16 Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'chrome' Setup Browser Chrome
17 Log Running with ${GLOBAL_SELENIUM_BROWSER}
Jerry Flood71b7b0f2017-10-02 16:25:06 -040018
19
DR695Hccff30b2017-02-17 18:44:24 -050020Setup Browser Firefox
Jerry Flood71b7b0f2017-10-02 16:25:06 -040021 ${caps}= Evaluate sys.modules['selenium.webdriver'].common.desired_capabilities.DesiredCapabilities.FIREFOX sys
22 Set To Dictionary ${caps} marionette=
23 Set To Dictionary ${caps} elementScrollBehavior 1
24 # TODO
25 # Figure out how to run FF headless without Xvfb
26 ${wd}= Create WebDriver Firefox capabilities=${caps}
27 Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${caps}
28
DR695Hccff30b2017-02-17 18:44:24 -050029 Setup Browser Chrome
Jerry Flood71b7b0f2017-10-02 16:25:06 -040030 ${os}= Get Normalized Os
DR695Hccff30b2017-02-17 18:44:24 -050031 Log Normalized OS=${os}
32 ${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
33 Call Method ${chrome options} add_argument no-sandbox
Jerry Flood71b7b0f2017-10-02 16:25:06 -040034 Run Keyword If ${HEADLESS}==True Call Method ${chrome options} add_argument headless
DR695Hccff30b2017-02-17 18:44:24 -050035 ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys, selenium.webdriver
36 Set To Dictionary ${dc} elementScrollBehavior 1
Jerry Flood71b7b0f2017-10-02 16:25:06 -040037 Create Webdriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc}
38 Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc}
DR695Hccff30b2017-02-17 18:44:24 -050039
Jerry Flood71b7b0f2017-10-02 16:25:06 -040040Handle Proxy Warning
DR695Hccff30b2017-02-17 18:44:24 -050041 [Documentation] Handle Intermediate Warnings from Proxies
Jerry Flood71b7b0f2017-10-02 16:25:06 -040042 ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_TITLE}
DR695Hccff30b2017-02-17 18:44:24 -050043 Return From Keyword if '${status}' != 'PASS'
Jerry Flood71b7b0f2017-10-02 16:25:06 -040044 ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}
DR695Hccff30b2017-02-17 18:44:24 -050045 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}