Change Management Schedule Optimization
[integration/csit.git] / tests / optf-cmso / cmso / 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           Selenium2Library
7
8 *** Variables ***
9 ${CHROME_DRIVER_WIN32_PATH}            drivers/win32
10 ${CHROME_DRIVER_MAC64_PATH}            drivers/mac64
11 ${CHROME_DRIVER_LINUX64_PATH}          drivers/linux64
12 ${CHROME_DRIVER_WIN32}            ${CHROME_DRIVER_WIN32_PATH}/chromedriver.exe
13 ${CHROME_DRIVER_MAC64}            ${CHROME_DRIVER_MAC64_PATH} /chromedriver
14 ${CHROME_DRIVER_LINUX64}          ${CHROME_DRIVER_LINUX64_PATH}/chromedriver
15
16 *** Keywords ***
17 Setup Browser
18     [Documentation]   Sets up browser based upon the value of 
19     [Arguments]    ${browser}
20     Run Keyword If    '${browser}' == 'firefox'    Setup Browser Firefox
21     Run Keyword If    '${browser}' == 'chrome'    Setup Browser Chrome
22     Log    Running with ${browser}
23     
24 Setup Browser Firefox
25     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.FIREFOX  sys, selenium.webdriver
26     Set To Dictionary   ${dc}   elementScrollBehavior    1 
27     Create Webdriver    Firefox    desired_capabilities=${dc}
28     ##Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}
29            
30  
31  Setup Browser Chrome
32     ${os}=   Get Normalized Os 
33     Log    Normalized OS=${os}
34     Run Keyword If    '${os}' == 'win32'    Append To Environment Variable    PATH    ${CHROME_DRIVER_WIN32_PATH}
35     ##Run Keyword If    '${os}' == 'win32'    Set Environment Variable    webdriver.chrome.driver    ${CHROME_DRIVER_WIN32}
36     Run Keyword If    '${os}' == 'mac64'    Append To Environment Variable    PATH    ${CHROME_DRIVER_MAC64_PATH}
37     #Run Keyword If    '${os}' == 'mac64'    Set Environment Variable  webdriver.chrome.driver    ${CHROME_DRIVER_MAC64}
38     Run Keyword If    '${os}' == 'linux64'    Append To Environment Variable    PATH    ${CHROME_DRIVER_LINUX64_PATH}
39     #Run Keyword if    '${os}' == 'linux64'     Set Environment Variable  webdriver.chrome.driver    ${CHROME_DRIVER_LINUX64}
40     ${chrome options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys
41     Call Method    ${chrome options}    add_argument    no-sandbox
42     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME  sys, selenium.webdriver
43     Set To Dictionary   ${dc}   elementScrollBehavior    1
44     Create Webdriver    Chrome   chrome_options=${chrome_options}    desired_capabilities=${dc}  
45     #Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}       
46
47 Handle ATT Speed Bump    
48     [Documentation]    Handle AT&T Speed Bump when accessing Rackspace UI from AT&T network
49     ${test}    ${value}=    Run keyword and ignore error    Title Should Be     Notice - Uncategorized Site
50     Run keyword If    '${test}' == 'PASS'    Click Element    xpath=//a[contains(@href, 'accepted-Notify-Uncategorized')]