Not able to enter value in text box inside the iframe

Hello,

My team is trying to automate web application using Watir. We are able
to automate the application flow successfully, but at the last point we
have process where we have to click on purchase button, an iframe gets
opened. We have to provide data values in the text box. We are not able
to automate this portion (iframe). Can anybody please help us to
automate iframe portion.

We have tried with the nested element to enter value, but watir is
not able to identify the text box.

e.g.

ie.div(:id, “div_b”).iframe(:id, “up_payframe”).text_field(:name,
“cc”).set “12345”

its not working.

below is the DOM structure taken from firebug

Nitin Nazare wrote in post #1095290:

Hello,

My team is trying to automate web application using Watir. We are able
to automate the application flow successfully, but at the last point we
have process where we have to click on purchase button, an iframe gets
opened. We have to provide data values in the text box. We are not able
to automate this portion (iframe). Can anybody please help us to

You can use “xpath”

“Not working” is vague. Do you get an error message? does the object
show as present? visible?

Have you tried using IRB and an active watir session to try various
selectors and see what happens?

Sometimes being more vague helps, like ie.text_field(:name,“cc”)

Also, try listing all frames and getting their names /ids

ie.frame(:index => 0).name

Interestingly the first result I noticed when looking up Watir and
iFrames was a comment that watir-webdriver works better with them.
Perhaps this is a possibility you could look into.