Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Selenium WebDriver 3.0

You're reading from   Mastering Selenium WebDriver 3.0 Boost the performance and reliability of your automated checks by mastering Selenium WebDriver

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781788299671
Length 376 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (19) Chapters Close

Title Page
Contributors
Packt Upsell
Preface
1. Creating a Fast Feedback Loop FREE CHAPTER 2. Producing the Right Feedback When Failing 3. Exceptions Are Actually Oracles 4. The Waiting Game 5. Working with Effective Page Objects 6. Utilizing the Advanced User Interactions API 7. JavaScript Execution with Selenium 8. Keeping It Real 9. Hooking Docker into Selenium 10. Selenium – the Future 1. Appendix A: Contributing to Selenium 2. Appendix B: Working with JUnit 3. Appendix C: Introduction to Appium 4. Other Books You May Enjoy Index

Using explicit waits


The recommended solution for waiting problems is to use explicit waits. There is already a class full of precanned examples called ExpectedConditions to make your life easy, and it really is not that hard to use them. You can do the simple things, such as finding an element once it becomes visible in two lines of code:

WebDriverWait wait = new WebDriverWait(getDriver(), 15, 100);
WebElement myElement = wait.until(ExpectedConditions.
visibilityOfElementLocated(By.id("foo")));

Bear in mind that the ExpectedConditions class are prime examples. While being helpful, they are really designed to show you how to set explicit waits up so that you can easily create your own. With these examples, it is trivial to create a new class with conditions that you care about in it, which can be reused again and again in your project.

Earlier, we said we would look at a way to work out if your site had finished processing AJAX requests; let's do that now. First of all, we will create a new...

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 £13.99/month. Cancel anytime
Visually different images