2

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

    1 Answer 1

    2

    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 
    2
    • Thanks you for your quick Reply. Its working to perfection now. Appreciate your time .. :)
      – Singh
      CommentedJul 8, 2016 at 2:28
    • Thanks for tip to add \ before =. This solved error: Calling method 'add_argument' failed: TypeError: add_argument() got an unexpected keyword argument '--user-data-dir'CommentedOct 7, 2020 at 19:08

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.