How to Force Selenic to Run Edge in inPrivate Window
I have a large number of Selenic tests that run in the Edge browser. I now require them to run in an Edge inPrivate windows. Is there some configuration I can do to the driver before opening the browser?
Thanks!
Best Answer
-
I am using an older version of Selenic (2021.1.2)
Support for Selenium 4 was added later in Selenic 2022.1. Until you are able to update your version of Selenium and Selenic, it looks like you can add arguments a different way for Selenium 3:
How to add arguments to edgeOptions in using edgeDriver selenium
1
Answers
-
This worked for me:
EdgeOptions options = new EdgeOptions(); options.addArguments("inprivate"); driver = new EdgeDriver(options);
I see "InPrivate" labels shown in the browser's title bar and tool bar.
0 -
Thanks for the answer benkin-parasoft. Unfortunately, I am getting and error that states 'The method addArguements(String) is undefined for the type EdgeOptions'. I have imports for org.openqa.selenium.edge.EdgeDriver and org.openqa.selenium.edge.EdgeOptions. Am I missing another one or perhaps I have an incorrect one? Thanks!
0 -
addArguements
Try "addArguments".
0 -
Sorry, my typing skills are not very good. I actually did have addArguments. When I use CTRL+ space for the hints for EdgeOptions, addArguments does not appear but setCapability does. I have seen when googling this question that some of the older posts use setCapability. So I have this but it does not seem to work.
EdgeOptions options = new EdgeOptions();
options.setCapability("inprivate", true);
// options.setCapability("-inprivate",true);
// options.addArguments("inprivate");
driver = new EdgeDriver(options);
I am using an older version of Selenic (2021.1.2) and plan to update to the latest versions of Selenic and SOATest soon. This is being developed and tested in IBM's Rational Application Developer (RAD) 9.7.0.4.
I confirmed that the Edge webdriver is the latest one and matches the version of Edge I am running.0 -
Thanks!
0