4

I'm trying to make automated tests for a site, using Selenium IDE (not Selenium Server, RC, 2.0, and WebDriver).

I want to be logged in with user 1 in Firefox window 1 and open a Firefox private window to sign in with user 2. I need this because the website I want to test doesn't allow multiple users signed in in the same browser at the same time.

So: 1) Is there a way to open a private/incognito window? 2) How do I then switch back to the main window?

Here's how switching between simple windows looks like: https://i.stack.imgur.com/P5bbt.png

Iunielle
  • 41
  • 1
  • 1
  • 4

3 Answers3

3

In the attached image you can see how I solved the problem: It works fine with Firefox version 42.0 (and earlier versions). With Firefox 43 I have some problems because "openWindow screen2" does not overwrite my window I open with javascript but opens an own window. I'm looking for a solution for this issue.

enter image description here

Stefan
  • 5,203
  • 8
  • 27
  • 51
  • 1
    For people who don't want to type out the javascript command from the screenshot: `javascript{link='https://www.dumpedit.com/adventure/'; window.open(link, "screen2", "private=yes, menubar=yes, location=yes, resizeable=yes, scrollbars=yes, titlebar=yes, status=yes");}` – frederix Apr 12 '16 at 16:27
  • 1
    Does this method still work in 2020? Or is it outdated? – Akhil Kintali Feb 12 '20 at 13:34
  • Nope, won't work in v3.17.2: `unexpected token: '{'` – Flo Bayer Mar 11 '22 at 11:37
0

As far as I'm aware this isn't something that Selenium IDE can do. The best solution I can think of would be to use something like Autohotkey and combine the it with Selenium.

With AHK you can set a script to mimic the keyboard command to open a private window (ctrl+shift+p). When I've used it with selenium in the past I've set the AHK script to start when it detects a certain window title, and then had selenium call a javascript function from the user-extensions to amend the title of the page you're on to the title which will trigger the function when you need the AHK script to run. (Best not to use the default one, otherwise you could end up with countless private windows if it hits that page multiple times).

Jsmith2800
  • 1,113
  • 1
  • 9
  • 18
-3

Try this,

FirefoxProfile firefoxProfile = new FirefoxProfile();    
firefoxProfile.setPreference("browser.private.browsing.autostart",true);