I am trying to automate script for testing using Watir-Webdriver. While writing a script, I am at a point where I have to fill in log in details. Now would it have been in a
In the following line, Watir will look for the element anywhere except for in iframes (and frames).
b.text_field(:id,'lid').set 'my value'
Unlike other elements, you must tell Watir when an element is in a frame. This is done similar to how you would scope the search of an element to a specific element.
For example, if there is only 1 iframe or your element is in the first iframe, you can do (noting the addition of the .iframe
):
b.iframe.text_field(:id => 'lid').set 'my value'
If there are multiple iframes, you will need to add parameters to be more specific about which iframe to use. For example, the frame has an id:
b.iframe(:id => 'zohoiam').text_field(:id,'lid').set 'my value'