Hi
We are noobs yet, we are running a cross browser test and need to start every browser in private mode. How could we pass this params to ranorex?
Thank you
Private browsing
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Private browsing
Hello CG08,
Unfortunately it is not possible to add arguments to the "Open Browser" action in a recording module.
A possibility is to use "UserCode"-Actions to start your browsers in private mode.
Please have a look at our User Guide to learn how to create "UserCode-Actions" under this link http://www.ranorex.com/support/user-gui ... tions.html
Unfortunately Safari has no command-line-arguments to start in private-mode.
Here is an example for the "User-Code" action
Kind regards,
Markus (S)
Unfortunately it is not possible to add arguments to the "Open Browser" action in a recording module.
A possibility is to use "UserCode"-Actions to start your browsers in private mode.
Please have a look at our User Guide to learn how to create "UserCode-Actions" under this link http://www.ranorex.com/support/user-gui ... tions.html
Unfortunately Safari has no command-line-arguments to start in private-mode.
Here is an example for the "User-Code" action
Code: Select all
public void OpenBrowserPrivate(string URL, string Browser)
{
string FFFlag="-private-window";
string IEFlag="-private";
string CHFlag="-incognito";
string flag="";
if(Browser=="Firefox")
flag=FFFlag;
else if(Browser=="Chrome")
flag=CHFlag;
else if(Browser=="IE")
flag=IEFlag;
else
flag="";
Host.Local.OpenBrowser(URL,Browser,flag,false,false);
}
Markus (S)
Re: Private browsing
Thank you Markus
I am testing your code, seems ok but I getting two instances of Firefox, one private and one regular, in this last one Ranorex is continuing with the following recorded modules. Chrome and IE seems working ok.
Could you help me with this?
I am testing your code, seems ok but I getting two instances of Firefox, one private and one regular, in this last one Ranorex is continuing with the following recorded modules. Chrome and IE seems working ok.
Could you help me with this?
Re: Private browsing
Mozilla changed the way Firefox does private browsing several releases ago. If you pass a URL to the command line in addition to the "-private" flag, Firefox will open the URL in a standard (non-private) window and will open a blank page in the private window. This is how it works and there is nothing Ranorex can do about it, unfortunately.
You might be able to open the private window without passing the URL and then navigate the browser to the URL after it is open.
You might be able to open the private window without passing the URL and then navigate the browser to the URL after it is open.
Shortcuts usually aren't...
Re: Private browsing
Sorry to answer only right now, but there is a workaround for Firefox:
- open your browser
- type about:config in the url bar
- search for "private"
- look for "browser.privatebrowsing.autostart"
- double-click on the line to put "true" for the value
You can now close your browser.
Every time you will pen the browser with the normal shortcut, the browser will open in private mode.
As I use Ranorex on a Virtual Machine to keep working even during the test session, it doesn't matter if my browser keeps in private mode.
- open your browser
- type about:config in the url bar
- search for "private"
- look for "browser.privatebrowsing.autostart"
- double-click on the line to put "true" for the value
You can now close your browser.
Every time you will pen the browser with the normal shortcut, the browser will open in private mode.
As I use Ranorex on a Virtual Machine to keep working even during the test session, it doesn't matter if my browser keeps in private mode.
Re: Private browsing
Unfortunately that doesn't solve the whole problem. They didn't want Firefox to start in private mode every time. They only wanted it to start in private mode when they told it to, and they wanted it to open the URL they typed in the command-line, in the private window.
Mozilla decided that security was more important than user convenience in this instance (rightly, I think) and stopped allowing a URL to be opened in private mode from the command line. This "feature" of other browsers could be used by malware to open hidden, malicious web pages in a private session that would then never be recorded in the history. Personally, I think all browsers should do it this way as it forces the user to know what is going on with their system. It is inconvenient for automation, but better for security.
Mozilla decided that security was more important than user convenience in this instance (rightly, I think) and stopped allowing a URL to be opened in private mode from the command line. This "feature" of other browsers could be used by malware to open hidden, malicious web pages in a private session that would then never be recorded in the history. Personally, I think all browsers should do it this way as it forces the user to know what is going on with their system. It is inconvenient for automation, but better for security.
Shortcuts usually aren't...