DVG
DVG

Reputation: 17480

How to not wait for something with Watir-Webdriver

So I'm writing a watir-webdriver script, and my app is using javascript to present a modal window that I want to interact with. When I click the element that presents the modal window, watir-webdriver just sits there until eventually it times out and i see a Timeout::Error on the console window. This is before attempting to interact with the new window at all. I'm assuming it's polling the DOM for some change and not getting it, how do I tell it to move on without waiting?

Upvotes: 2

Views: 1354

Answers (3)

Ruchir
Ruchir

Reputation: 11

Ruby 1.9.3/ IE 9 - I had a click_no_wait error. Watir would not trigger a click on the Save button, which had to be followed by a click on a java popup 'OK' button that confirmed that the save button had saved the document correctly.

Using these two lines in place of the click_no_wait command gets the code working perfectly:

element.focus 
element.send_keys :return

Thanks DVG. My code -

ie.button(:id, 'MainContent_B_Save').focus
ie.button(:id, 'MainContent_B_Save').send_keys :return 
ie. javascript_dialog.button('OK').click

Upvotes: 1

DVG
DVG

Reputation: 17480

The answer ended up being, and then handling the necessary waiting manually

element.focus
element.send_keys :return

Upvotes: 1

Chuck van der Linden
Chuck van der Linden

Reputation: 6660

If this is a Alert, Confirm, or Alert type JS popup, see this answer: https://stackoverflow.com/a/8172888/409820

Upvotes: 0

Related Questions