简体   繁体   中英

How can we open a URL in Chrome Icognito mode using Robot Framework

Can anyone please help me how to open a URL in Chrome browser in Icognito mode , as the URL that i'm trying to open in chrome is giving 404 error but is opening successfully in Icognito. Please guide me what Robot command should be given to open in Icognito mode . Thank you.

    ${options}=    Evaluate  sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver
    Call Method    ${options}    add_argument    incognito
    Create WebDriver    Chrome    chrome_options=${options}
    Go To    https://www.google.com

This should work:

Open Browser | ${url} | Chrome | options=add_argument("--incognito")

Robotframework always creates a 'clean' session of chrome so it shouldn't make a difference.

If you still want to run a incognito session, you could set --incognito option:

Open Browser      ${url}      Chrome     options=addArguments("--incognito")

You can find what you can pass to the browser here: http://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Open%20Browser

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM