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, 2019 in Selenium by Firoz
1,255 views

2 answers to this question.

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 9, 2019 by Pratibha
• 3,690 points
0 votes

Hi ,

for Ajax call better to use Explicit Wait():

answered Sep 3, 2020 by Sri
• 3,190 points

Related Questions In Selenium

+2 votes
3 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
• 58,090 points
1,143 views
0 votes
1 answer

Which methods which can be used to handle pop-up and alerts in Python Selenium Webdriver?

Hey Kishor, Python Selenium webdriver provides following ...READ MORE

answered Jul 29, 2019 in Selenium by Abha
• 28,140 points
723 views
0 votes
1 answer
0 votes
2 answers

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

Veracode is the best due to banking ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
714 views
0 votes
2 answers

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,500 points
12,743 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,618 views
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,910 points
6,696 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,558 views
0 votes
2 answers

What is the best way to handle a Javascript popup using Selenium Webdriver?

webDriver.switchTo().alert() it inbuild selenium only //Store the alert ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
10,416 views
0 votes
1 answer

Can anyone explain which all methods are contained by Hard Assertion?

Hello @Monika, a Hard Assertion contains following ...READ MORE

answered May 14, 2019 in Selenium by Pratibha
• 3,690 points
414 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP