Thursday, January 17, 2013

Selenium WebDriver - Automate Ajax calls


What is Ajax:
Ajax is “the method of exchanging data with a server, and updating parts of a web page – without reloading the entire page.” Ajax itself is mostly a generic term for various JS techniques used to connect to a web server dynamically without 
necessarily loading multiple pages. 

When we perform any action on Ajax controls, using Wait commands will not work as the page is not actually refreshed here. Pausing the test execution using threads for a certain period of time is also not a good approach as web element might appear later or earlier than the stipulated period of time depending on the system’s responsiveness, load or other uncontrolled factors of the moment, leads to test failures.

The best approach would be to wait for the required element in a dynamic period and then continue the test execution as soon as the element is found/visible.

Go to http://demos.telerik.com/aspnet- 
     ajax/ajax/examples/loadingpanel/explicitshowhide/defaultcs.aspx

Wait for grid to appear
Get the text before performing an ajax call
Click on the date
Wait for loader to disappear 
Get the text after ajax call


Welcome

Hi Guys,

Welcome to Selenium Automation, where you can learn lot on Selenium Web Driver, Test NG, Frameworks and many more.....


Thanks
-Gururaj