X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ric_robot_suite%2Frobot%2Fresources%2Fbrowser_setup.robot;fp=ric_robot_suite%2Frobot%2Fresources%2Fbrowser_setup.robot;h=5d34d3de41e17d2a563a39251e16fe0d868e6164;hb=c5fa07bcd8cbd614bcd813cac698385b789bcfcb;hp=0000000000000000000000000000000000000000;hpb=59f84608ec15c016958a6e0e0ddd813f376c0925;p=it%2Ftest.git diff --git a/ric_robot_suite/robot/resources/browser_setup.robot b/ric_robot_suite/robot/resources/browser_setup.robot new file mode 100644 index 0000000..5d34d3d --- /dev/null +++ b/ric_robot_suite/robot/resources/browser_setup.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation The main interface for interacting with VID. It handles low level stuff like managing the selenium request library and VID required steps +Library Collections +Library OSUtils +Library OperatingSystem +Library ExtendedSelenium2Library +Resource global_properties.robot + +*** Variables *** +${HEADLESS} True + +*** Keywords *** +Setup Browser + [Documentation] Sets up browser based upon the value of ${GLOBAL_SELENIUM_BROWSER} + Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'firefox' Setup Browser Firefox + Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'chrome' Setup Browser Chrome + Log Running with ${GLOBAL_SELENIUM_BROWSER} + + +Setup Browser Firefox + ${caps}= Evaluate sys.modules['selenium.webdriver'].common.desired_capabilities.DesiredCapabilities.FIREFOX sys + Set To Dictionary ${caps} marionette= + Set To Dictionary ${caps} elementScrollBehavior 1 + # TODO + # Figure out how to run FF headless without Xvfb + ${wd}= Create WebDriver Firefox capabilities=${caps} + Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${caps} + + Setup Browser Chrome + ${os}= Get Normalized Os + Log Normalized OS=${os} + ${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys + Call Method ${chrome options} add_argument no-sandbox + Run Keyword If ${HEADLESS}==True Call Method ${chrome options} add_argument headless + ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys, selenium.webdriver + Set To Dictionary ${dc} elementScrollBehavior 1 + Create Webdriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc} + Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} + +Handle Proxy Warning + [Documentation] Handle Intermediate Warnings from Proxies + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_TITLE} + Return From Keyword if '${status}' != 'PASS' + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} + Return From Keyword if '${status}' != 'PASS' + Return From Keyword if "${GLOBAL_PROXY_WARNING_TITLE}" == '' + Return From Keyword if "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == '' + ${test} ${value}= Run keyword and ignore error Title Should Be ${GLOBAL_PROXY_WARNING_TITLE} + Run keyword If '${test}' == 'PASS' Click Element xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} \ No newline at end of file