robotframework-cookbook
robotframework-cookbook copied to clipboard
Recipe suggestion for chrome driver desired capabilities options
In recent times i have tried downloading pdf files from chrome and got stuck with setting chrome options in robot framework. Did searched through all possible ways and found the solutions. which took lot of time to understand the syntax in robot. Please add recipes for different types of driver setup in robot framework with all desired capabilities. it will be lot useful for beginners. Attaching code snippet am using now for reference.
*** Variables ***
${BROWSER} chrome
${DOWNLOAD_DIR} ${CURDIR}/../temp
${REMOTE URL} http://127.0.0.1:4444/wd/hub
&{OPTION}
&{DESIRED_CAPABILITIES} name=browserTest enableVNC=${True}
*** Keywords ***
Login To OMS
[Documentation] login for oms
${profile} Create dictionary enabled=${False} name=Chrome PDF Viewer
${list profile} Create list ${profile}
${prefs} Create Dictionary plugins.plugins_list=${list profile}
... plugins.always_open_pdf_externally=${True}
... download.extensions_to_open=applications/pdf download.prompt_for_download=${False}
... safebrowsing.enabled=${True} download.default_directory=/../temp
${chrome options} Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome options} add_experimental_option prefs ${prefs}
Open Browser ${LOGIN URL} ${BROWSER} desired_capabilities=${DESIRED_CAPABILITIES}
... options=${chrome options}