DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 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 *** |
Jerry Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 10 | ${HEADLESS} True |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 11 | |
| 12 | *** Keywords *** |
| 13 | Setup 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 Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 18 | |
| 19 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 20 | Setup Browser Firefox |
Jerry Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 21 | ${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 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 29 | Setup Browser Chrome |
Jerry Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 30 | ${os}= Get Normalized Os |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 31 | Log Normalized OS=${os} |
| 32 | ${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys |
| 33 | Call Method ${chrome options} add_argument no-sandbox |
Jerry Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 34 | Run Keyword If ${HEADLESS}==True Call Method ${chrome options} add_argument headless |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 35 | ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys, selenium.webdriver |
| 36 | Set To Dictionary ${dc} elementScrollBehavior 1 |
Jerry Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 37 | Create Webdriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc} |
| 38 | Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 39 | |
Jerry Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 40 | Handle Proxy Warning |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 41 | [Documentation] Handle Intermediate Warnings from Proxies |
Jerry Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 42 | ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_TITLE} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 43 | Return From Keyword if '${status}' != 'PASS' |
Jerry Flood | 71b7b0f | 2017-10-02 16:25:06 -0400 | [diff] [blame] | 44 | ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 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} |