I have a need so as to enter some text in a text field and then tabout of the text field so that the value in the text field gets validated by a service. I tried to click some other elements in the page but that apparently did not trigger an event to call the service. Is there a workaround in this case? Thank you!
class MyPage
include PageObject
text_field(:txtinput, :id => 'textV1')
span(:for,:id => 'For' )
def enter_my_info(data)
self.txtinput = data
self.for_element.click # click someother element in the page
end
end
That type of behaviour often is often triggered by an 'onblur' event. You can manually trigger this use the page object element's fire_event
method.
def enter_my_info(data)
self.txtinput = data
self.txtinput_element.fire_event('onblur')
end
If that does not work, you could try mimicking the user behaviour and input a tab character. You can send special keys via the send_keys
method.
def enter_my_info(data)
self.txtinput = data
self.txtinput_element.send_keys(:tab)
end