1

In Siteprism i need to find out to wait for an element to be enabled before performing any action like click/select.

currently i am using this by Siteprism:

@page.wait_for_page_element(10)

But looks like that's not enough waiting. Still my script fails as the element was visible but not enabled. Need a solution.

SaeeK
  • 217
  • 1
  • 4
  • 12

1 Answers1

0

You don't show how you've defined the element - but I assume you just did something like element :page_element, '#my_page_element' - The problem with this is it doesn't give any indication that the element is a actually a field and doesn't allow for using any of the field matching filters. If instead you define the element as

element :page_element, :field, '#my_page_element'

Then I believe calling wait_for_page_element on it will actually wait for it to be enabled since Capybara finds only enabled fields by default. If it doesn't or if you want to wait for a disabled field to be on the page then you can pass filter options (disabled, checked, readonly, etc) to wait_for_page_element

@page.wait_for_page_element(10, disabled: false) 
Thomas Walpole
  • 48,548
  • 5
  • 64
  • 78
  • I have actually used: @page_wait_until_element_visible . This helped me. – SaeeK Dec 14 '15 at 23:51
  • ok -- although visible is not the same as enabled - unless you specify the :field selector for the element - in which case it does default to only enabled fields – Thomas Walpole Dec 14 '15 at 23:54