Webdirver Python - open new tab in incognito mode

734 views
Skip to first unread message

Kamil

unread,
Jan 22, 2014, 4:44:01 AM1/22/14
to seleniu...@googlegroups.com
Hi, 

is there a way to open new TAB in browser (Firefox, Chrome, whatever...) in incognito mode?
Not from begining of test. I am opening new tabs like this:

 
        # Open additional windows CHECKED
        driver
.find_element_by_xpath("//a[contains(text(),'Presentation view')]").click()
        handles
= driver.window_handles
        driver
.switch_to_window(handles[0])
        driver
.find_element_by_xpath("//a[contains(text(),'Participant view')]").click()
        handles
= driver.window_handles
        driver
.switch_to_window(handles[0])
        driver
.find_element_by_xpath("//a[contains(text(),'Participant view')]").click()
        handles
= driver.window_handles
        driver
.switch_to_window(handles[0])
        driver
.find_element_by_xpath("//html/body/div[5]/div[2]/ul/li[4]/a").click()

then I know which one window handle is which TAB, but I need to open some of these TABs in incognito mode.

is it possible?

thank you,
Kamil

David Lai

unread,
Jan 22, 2014, 12:26:33 PM1/22/14
to seleniu...@googlegroups.com
I don't think you can on the fly.  It is possible to pass some flags into the webdriver instantiation to start up a webdriver in incognito, but you cannot start in normal mode then switch to incognito.  You might try doing the test first with 1 instance of webdriver in normal, then start a 2nd instance in incognito to take over.

Kwame Akuffo

unread,
Jan 22, 2014, 2:09:34 PM1/22/14
to seleniu...@googlegroups.com
Hi,

Try this code

profile.setPreference("browser.private.browsing.autostart", true);



On 22 Jan 2014, at 17:26, David Lai <sbs...@gmail.com> wrote:

incognito mode

fahad khan

unread,
Jan 22, 2014, 3:27:28 PM1/22/14
to seleniu...@googlegroups.com


On Wednesday, January 22, 2014 2:44:01 PM UTC+5, Kamil wrote:
Hi, 
can you send me WIFI Deriver
Reply all
Reply to author
Forward
0 new messages