0

I am using Ruby with Cucumber and attempting to build up a suite of automated tests against a dynamics 2013 system. We have a cart that is a nested into an iFrame and we are attempting to enter a product into a text field.

The code that we have is :

@browser.switch.frame(id: 'navLink{bd27b00e-3d5e-b7b5-0ddb-864216077292}AreaFrame')
@browser.input(id: 'addQuickProductTextBox').set("MM-000001-NF Nurse Full")

But using this code I get the message:

Watir::Exception::UnknownFrameException: unable to locate iframe using {:id=>"navLink{bd27b00e-3d5e-b7b5-0ddb-864216077292}AreaFrame", :tag_name=>"iframe"}

The HTML is in attached snap:

Top Level IFrames Table Details Data Field

0

As per the image you attached, it seems that you are using the wrong id for iframe. Its id value should be "contentIFrame1".

In Watir you can do something like:

@browser.iframe(id: 'contentIFrame1').iframe(id:'navLink{bd27b00e-3d5e-b7b5-0ddb-864216077292}AreaFrame').text_field(id: 'addQuickProductTextBox').set("MM-000001-NF Nurse Full")
  • Hi Roman. Thank you for the suggestion, however trying that returns the following error - Watir::Exception::UnknownObjectException: timed out after 30 seconds, waiting for #<Watir::TextField: located: false; {:id=>"contentIFrame1", :tag_name=>"iframe"} --> {:id=>"addQuickProductTextBox", :tag_name=>"input"}> to be located – Matthew Mills Oct 23 '18 at 7:55
  • oh, sorry, I didn't see the second iframe there. Check if this work so: @browser.iframe(id: 'contentIFrame1').iframe(id:"'navLink{bd27b00e-3d5e-b7b5-0ddb-864216077292}AreaFrame'").text_field(id: 'addQuickProductTextBox').set("MM-000001-NF Nurse Full") If it works, I'll update the first answer. For more info about frames iframe – roman Oct 23 '18 at 12:57
  • Hi Roman. Thank you that helped the code that worked in the end is - @browser.iframe(id: 'contentIFrame1').iframe(id:'navLink{bd27b00e-3d5e-b7b5-0ddb-864216077292}AreaFrame').text_field(id: 'addQuickProductTextBox').set("MM-000001-NF Nurse Full") – Matthew Mills Oct 23 '18 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.