-
-
Save tompurl/903346c73b8ada17d988e1f2fb99f7f3 to your computer and use it in GitHub Desktop.
Selenium2Library with Chrome Headless Mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Settings *** | |
Library Selenium2Library | |
*** Variables *** | |
${url} https://medium.com/@nottyo/ | |
@{chrome_arguments} --disable-infobars --headless --disable-gpu | |
${page_text} Traitanit | |
${timeout} 10s | |
*** Test Cases *** | |
TC_EXP_00001 | |
[Documentation] Sample Test For Chrome Headless | |
[Tags] chrome headless | |
${chrome_options}= Set Chrome Options | |
Create Webdriver Chrome chrome_options=${chrome_options} | |
Go To ${url} | |
Wait Until Page Contains ${page_text} ${timeout} | |
Capture Page Screenshot | |
[Teardown] Close Browser | |
*** Keywords *** | |
Set Chrome Options | |
[Documentation] Set Chrome options for headless mode | |
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver | |
: FOR ${option} IN @{chrome_arguments} | |
\ Call Method ${options} add_argument ${option} | |
[Return] ${options} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment