What are the wait methods which can be used to handle AJAX calls?

0 votes
What are the wait methods which can be used to handle AJAX calls in Selenium Webdriver?
May 8 in Selenium by Firoz
9 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hey Firoz, wait methods which can be used in Selenium Webdriver to handle AJAX calls are as follows:

  1. Thread.Sleep(): Thread.Sleep () suspends the current thread for the specified amount of time. In AJAX, you can never be sure about the exact wait time. So, your test will fail if the element won't show up within the wait time. Moreover, it increases the overhead because calling Thread.sleep(t) makes the current thread to be moved from the running queue to the waiting queue. After the time 't' reached, the current thread will move from the waiting queue to the ready queue, and then it takes some time to be picked by the CPU and be running.
     
  2. Implicit Wait(): This method tells webdriver to wait if the element is not available immediately, but this wait will be in place for the entire time the browser is open. So any search for the elements on the page could take the time the implicit wait is set for.
     
  3. Explicit Wait(): It is used to freeze the test execution till the time a particular condition is met or maximum time lapses.
     
  4. WebdriverWait: It can be used for any conditions. This can be achieved with WebDriverWait in combination with ExpectedCondition. The best way to wait for an element dynamically is checking for the condition every second and continuing to the next command in the script as soon as the condition is met.
     
  5. Fluent Wait: This is an implementation of the Wait interface having its timeout and polling interval. Each FluentWait instance determines the maximum amount of time to wait for a condition, as well as the frequency with which to check the condition.
answered May 8 by Pratibha
• 2,520 points

Related Questions In Selenium

+2 votes
2 answers

What are the different Locators that can be used to access Web Elements?

@Nitesh, I would like to tell you ...READ MORE

answered Dec 12, 2018 in Selenium by Priyaj
• 56,120 points
38 views
0 votes
1 answer

What are the different tools that can be used for Security Testing?

The different tools used for security testing ...READ MORE

answered Feb 19 in Selenium by Ria
30 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
65 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
438 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
51 views
0 votes
1 answer
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.