Reputation: 21
I am trying to Learn Robot Framework. I have already worked on Selenium Webdriver. I was trying to open the Chrome Browser from an Exiting Profile using Create Webdriver Keyword. However i am not able to do . It Seems that Robot Framework Opens a new Chrome Profile Everytime. Here is the Code that i got after goggling, but this is not opening Chrome from the User data folder that i prefer. Any Suggestions or Ideas this can be achieved.
Open Chrome Using Create WebDriver Keyword
[Tags] chrome
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
${options.add_argument}= Set Variable --allow-running-insecure-content
${options.add_argument}= Set Variable --disable-web-security
${options.add_argument}= Set Variable user-data-dir = /Users/myName/AppData/Local/Google/Chrome/User Data
Create WebDriver Chrome chrome_options=${options}
go to {URL}
# Close Browser
Upvotes: 2
Views: 5521
Reputation: 2384
To add arguments, call the add_argument method of the ChromeOptions object. Note that you need to escape the '=' in the --user-data-dir argument or Robot Framework will look for an argument called '--user-data-dir' and fail. When testing this I noticed that a profile will be created in the location specified if it does not exist.
Open Chrome Using Create WebDriver Keyword
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${options} add_argument --allow-running-insecure-content
Call Method ${options} add_argument --disable-web-security
Call Method ${options} add_argument --user-data-dir\=/Users/myName/AppData/Local/Google/Chrome/User Data
Create WebDriver Chrome chrome_options=${options}
Go To https://stackoverflow.com
Upvotes: 2