5

When you start a Web-driver using Selenium, It opens a new and very fresh instance of respective web browser ( looks as if just installed, no history and default settings}.

Is there any way to open usual windows which will have customized settings which I have done in my chrome or Firefox like add-ons and all ?

1 Answer 1

4

You can use existing profile in FireFox

File profileDir = new File("Path to default profile")
FirefoxProfile firefoxProfile = new FirefoxProfile(profileDir);    
WebDriver webDriver = new FirefoxDriver(firefoxProfile);

For Chrome, you can go with options as below:

ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:/Users/user_name/AppData/Local/Google/Chrome/User Data");
driver = new ChromeDriver(options);
Sign up to request clarification or add additional context in comments.

4 Comments

But in that case , you are actually adding setting to your new instance. I am interested if we can open the old usual windows only. Suppose there is some intranet links which does not open on new instances ( security purpose), But works fine on usual browser windows.
@Manish Updated answer. Please check
Thanks. It gave error while File.But FirefoxProfile firefoxProfile = new FirefoxProfile(@"C:\Users\mkh6kor\AppData\Roaming\Mozilla\Firefox\Profiles\rwyq8vbx.default"); Worked like charm.
Any idea how to do the same in python? @nitinchawda

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.