Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Please brief me about the Ajax testing with selenium RC. As in Ajax element does not reflect on the view-source, but using firebug we can see the changes in HTML source code.

There are two methods associated with it..

1-The method "waitForCondition (java.lang.String script, java.lang.String timeout), to provide script we have to create a java script by own or it should be the same Ajax script/java script present on the web page.

Please correct me if i am wrong on below point..

2-The method "waitForElemantPresent(Locator)", We check the Element in the firebug and check the same in this method is self waitForElemantPresent(Locator).

Let me know if anything else I am missing testing Ajax application.

share|improve this question
    
Well if you answered your question and have got it right too :) –  Tarun Jun 28 '11 at 18:41
    
Hey @Tarun I still need the answer of the first point...:) Thanks a lot again –  smriti Jun 29 '11 at 9:41
add comment

2 Answers

up vote 2 down vote accepted

I already gave an example on a similar question which can be used to wait for Ajax and javascripts to finish.

Here it is:

selenium.waitForCondition(
        "selenium.browserbot.getCurrentWindow().jQuery.active == 0",
        timeout);

Cheers!

share|improve this answer
    
Only works if you are using jQuery, won't work for all AJAX sites. –  Ardesco Jun 30 '11 at 11:08
    
Thanks a lot Hannibal and Ardesco for this great help. I got this form one article agilesoftwaretesting.com/?p=111 JQuery: “jQuery.active” Prototype: “Ajax.activeRequestCount” Dojo: “dojo.io.XMLHTTPTransport.inFlight.length” So if there is Ajax call we can use second option. Please correct me if I am missing something …. Thanks in Advance –  smriti Jun 30 '11 at 12:33
1  
True. But you can easily attune it to something else. :) Glad it helped smriti! :) –  Hannibal Jun 30 '11 at 12:33
add comment

You could you wait for condition like this -

selenium.waitForCondition("selenium.isElementPresent(\"element locator\")", "waitPeriod")

Hence you need to write the wait condition and here in I have used one of the Selenium API it self

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.