1
votes

Whenever a page load happens after selecting a value from list box or clicking a button, watir waits for the page to load. But in watir webdriver it doesn't wait in the case of list box selection. I used both watir and watir-webdriver against the same application.

Can anyone confirm this behavior? Any idea why it was there in watir but not in watir webdriver?

Update:

@browser.text_field(:id,"name").set("Sivaguru")
@browser.select_list(:id,"Gender").select("Male")
@browser.button(:id,"Submit").click
@browser.text_field(:id,"comments").set("sample")

In the above sample code, two times the page is loaded. one is after the selection and the other one is after click on the button.

In the case of watir , it by default waits for both the page loads. But watir webdriver waits in the case of button click but not on selection.

Since I am working on migrating from watir to webdriver i am interested to understand this behaviour before do changes to the existing code.

1
This all depends on the content you are testing. If the page appears to be dynamically reloading just a section of the page, you'll need to wait for AJAX operations to finish before calling any additional WatirWebdriver code. Does using a select list redirect you to an entirely new page or just a section of the page?Sonja Leaf
If you post the minimal amount of code to reproduce the issue, it will help others provide better, less speculative answers.orde
@orde I have provided additional details to my question. These days most of the people don't reload entire page and they dynamically update part of the page using Ajax. Therefore I am not able find out a sample application.sivaguru perumal
@A.V.Leaf This is an old application and hence the entire page is reloaded. We don't use Ajax heresivaguru perumal

1 Answers

0
votes

I cannot speak to Watir, but Watir-webdriver has plenty of methods available that would allow you wait until an element is present/visible before acting on it. I personally have not used watir, but my assumption based on your question would be that watir possibly takes care of the waiting for you, whereas watir-webdriver gives you more control but allowing you deliberate control over the waiting