1. Download Chromedriver 2.4
2. Extract the zipped folder chromedriver_win32.zip and locate .exe file to C:/ folder
System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:/Users/user_name/AppData/Local/Google/Chrome/User Data");
options.addArguments("--start-maximized");
driver = new ChromeDriver(options);
If you face such error:
"org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally"
Then try to create a new Chrome profile and execute tests.
1| Copy the folder, 'User Data' and paste it on the same folder with different name. e.g., New User
2| Open the folder, 'New User'.
3| Rename the folder, 'Default'; so that after your test run, a new folder named, 'Default' will be created.
4| Now, replace the directory on your code with C:/Users/user_name/AppData/Local/Google/Chrome/New User
5| If you like to test the profile, then bookmark some of the sites & observe them on next run.
Note:-
IE doesn't need profile setup to run tests because they run on Server user while Firefox and Chrome works with binary.
2. Extract the zipped folder chromedriver_win32.zip and locate .exe file to C:/ folder
System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:/Users/user_name/AppData/Local/Google/Chrome/User Data");
options.addArguments("--start-maximized");
driver = new ChromeDriver(options);
If you face such error:
"org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally"
Then try to create a new Chrome profile and execute tests.
1| Copy the folder, 'User Data' and paste it on the same folder with different name. e.g., New User
2| Open the folder, 'New User'.
3| Rename the folder, 'Default'; so that after your test run, a new folder named, 'Default' will be created.
4| Now, replace the directory on your code with C:/Users/user_name/AppData/Local/Google/Chrome/New User
5| If you like to test the profile, then bookmark some of the sites & observe them on next run.
Note:-
IE doesn't need profile setup to run tests because they run on Server user while Firefox and Chrome works with binary.
Good Job
ReplyDeleteHI Admin,
ReplyDeleteI tried the above code but only the normal browser is openning, i could not able to open sepecific profile browser using this code can u please help me.
Regards
sakthy
Sakthy, thanks for letting me know this; I have changed the deprecated Chromedriver link; Also updated the code. Please let me know on any issues.
ReplyDeleteCheers!
Sams
Hi Sam,
ReplyDeleteFirst of all thanks for sharing the knowledge...:)
I tried this and it worked for me when there were no other chrome instance present in the system, it launched a fresh browser window and loaded the URL...fine
But when there is a chrome window already present , the code opens another tab and then it seems not working and throwing "org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally"...
Also do you have any idea what arguments we need to pass to change the chrome profile in a such a way that it will ask the user 'where to save the file window dialogue when downloading it' ... we can change this manually from the chrome settings .... but that looks not persisting in the browser opened by chrome driver....
Hi Musaffir,
ReplyDeleteI am also experiencing the same issue . Please tell me how it worked for you
Thanks
On what server running IE?
ReplyDeletethanks
ReplyDeleteThe problem i am facing it did open the chrome browser but URL is not loading.
ReplyDeleteEven for me chrome browser is launched but the URL is not loading. Are you still facing this issue? If not please let me know the solution.
DeleteHow to set preferences for Chrome? Pls help.
ReplyDeleteIs there any way to reload the same chrome profile for each test??
ReplyDeleteThank you Prashanth S, it is really working, if you all are trying to load profile for Cookies with/before above Prashanth code. Take a copy of Default\Cookies file and paste/replace it before Loading Driver. After loading Driver if you want specific cookies then you can use addcookie to add specific cookies(For More info Refer Guru99 site- Retriving adding cookies at runtime).
ReplyDeleteThis comment has been removed by the author.
ReplyDeletebape outlet
ReplyDeletegolden goose shoes
jordan shoes
supreme t shirt
supreme clothing
off white shoes
lebron 17
nike off white
yeezy boost 500
pg 4
over at this website Dolabuy Valentino read this buy replica bags have a peek at these guys replica bags online
ReplyDeleted1y13v3d24 c7f42t9h86 p0h45p8j99 d1n65b6f97 b5s23r7e22 u5f49x9r71
ReplyDeletejordan shoes
ReplyDeleteoff white
chrome hearts