Web Application Testing in Ruby
IFrames
Firewatir (and maybe Watir and Watir-webdriver too) is somewhat stateful when interacting with iframes. Calling frame.locate switches Firewatir's internal context into the frame. Once Firewatir's internal context is switched to the iframe code can interact with that frame's elements. However, interacting with those elements resets Firewatir's context back to the root document. So repeated calls to locate can be used to establish the right internal context before subsequent element interactions. Related bug. Here is a code snippet used to interact with an AJAX button in an iframe that does not respond to click events, but rather responds to a sequence of mousedown/mouseup events.
browser.frame(:index, 1).locate
browser.div(:id, "somebutton").fire_event("onmousedown")
browser.frame(:index, 1).locate
browser.div(:id, "somebutton").fire_event("onmouseup")
No comments:
Post a Comment