Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Selenium Essentials

You're reading from  Selenium Essentials

Product type Book
Published in Mar 2015
Publisher
ISBN-13 9781784394332
Pages 194 pages
Edition 1st Edition
Languages
Author (1):
Prashanth Sams Prashanth Sams
Author Profile Icon Prashanth Sams
Prashanth Sams
Toc

Tests from the custom Chrome profile


Google Chrome is always the preferable browser on which to run tests. The Firefox and Chrome browsers work with binary. However, Internet Explorer doesn't need a profile to be set up to run tests because they run on the server user. In Chrome, the user data directory contains all the data of the given user, which includes history, bookmarks, and cookies. Add the following snippet to run tests from a new profile:

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);

Note

If you face an error such as org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally, then create a new Chrome profile and execute the tests.

To get more information on the user data location (for different OS platforms...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime