How to enter text into a text field nested in an iFrame?



  • 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



  • 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")
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2