WebRat+Selenium WebDriver: wait for ajax to be completed -
We are running Webrat with Selenium 2.0 aka WebDriver in our application.
The WebDriver manages to reload the page is fine and if the next page is reloading the browser will not start the next steps. The problem is that this mechanism does not work with Ajax requests. The WebDriver does not do any inactivity, after a few clicks () or changes ().
Can anyone suggest how to disable webdriver by the end of all AJAX requests on the page?
We wrapped the call in an optional loop and finished writing a layer on the Selenium handling this scenario . So when you do:
@ Browser.Click "#my_button_id"
This will do something like automatic-recommended above (Locator, timeout => PAGE_EVENT_TIMEOUT) @ selenium.click (locator) for waiting for end def_Allement (locator, option) timeout = option:
class browserdef (locator) wait_file_Element (locator, : Timeout] || PAGE_LOAD_TIMEOUT selenium_locator = locator.clone expression = & lt; & Lt; EOF var element; Try {element = selenium.browserbot.findElement ('# selenium_locator}'); } Hold (e) {element = null; }; Element! = Null; EOF selenium.wit_firodation (expression, timeout) Rescue: Selenium :: Selenium Exception raising "The element with the ## location '## Locator' could not be found on the page: # {$!}. \ N The passergen was passed to Selenium The wrapper did other things, such as permission to search for buttons / input labels, etc. (The cover for doing so) was '# {Selenium_locator}' & & End
Not only was the issues of time in existence, it was just one of those things We had.)
Comments
Post a Comment