0

My HTML

<td>
  <iframe id="Name_IF" style="left: auto; top: auto; width: 100%; height: 22px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; margin-top: auto; margin-right: auto; margin-bottom: auto; margin-left: auto; vertical-align: bottom; border-top-color: rgb(112,112,112); border-right-color: rgb(112,112,112); border-bottom-color: rgb(112,112,112); border-left-color: rgb(112,112,112); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; float: none; display: inline; position: static; background-color: white;"
  src="/a.rapidspellweb?t=r&n=blank.html" tabindex="0" frameborder="0">
    <html spellcheck="false">

    <head>

      <body class="RS_SingleLineTB" style="color: rgb(33,33,33); line-height: normal; letter-spacing: normal; overflow: hidden; clear: none; font-family: MS Shell Dlg; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; vertical-align: auto; border-top-width: medium; border-right-width: medium; border-bottom-width: medium; border-left-width: medium; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; float: none; list-style-type: disc; list-style-position: outside; list-style-image: none; page-break-before: auto; page-break-after: auto; cursor: auto; unicode-bidi: normal; direction: ltr; ruby-align: auto; ruby-position: above; ruby-overhang: auto; layout-grid-char: none; layout-grid-line: none; layout-grid-mode: both; layout-grid-type: loose; overflow-x: hidden; overflow-y: hidden; zoom: normal; layout-flow: horizontal; writing-mode: lr-tb; caption-side: top; box-sizing: content-box; orphans: 2; widows: 2; page-break-inside: auto; empty-cells: show; background-image: none; background-attachment: scroll; background-repeat: repeat; background-position-x: 0%; background-position-y: 0%; background-color: rgb(255, 255, 255);"
      contentEditable="true" onload="loaded=true;">
        <nobr/>
<input name="Description" id="Name" style="width: 100%; display: none;" onchange=" HE(event,this,'applylogic');" ChangeMessage="applylogic" jQuery17108595534879847912="5" rsw_extension="[object Object]" spellchecktimeoutid="21" />

I need to enter a text in the input field, but unable to find the input field with ID. Also while using Developer Tools in IE, when I select,

<input name="Description" id="Name" style="width: 100%; display: none;" onchange=" HE(event,this,'applylogic');" ChangeMessage="applylogic" jQuery17108595534879847912="5" rsw_extension="[object Object]" spellchecktimeoutid="21" />

nothing gets highlighted. The input field gets highlighted on selecting,

<body class="RS_SingleLineTB" style="color: rgb(33,33,33); line-height: normal; letter-spacing: normal; overflow: hidden; clear: none; font-family: MS Shell Dlg; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; vertical-align: auto; border-top-width: medium; border-right-width: medium; border-bottom-width: medium; border-left-width: medium; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; float: none; list-style-type: disc; list-style-position: outside; list-style-image: none; page-break-before: auto; page-break-after: auto; cursor: auto; unicode-bidi: normal; direction: ltr; ruby-align: auto; ruby-position: above; ruby-overhang: auto; layout-grid-char: none; layout-grid-line: none; layout-grid-mode: both; layout-grid-type: loose; overflow-x: hidden; overflow-y: hidden; zoom: normal; layout-flow: horizontal; writing-mode: lr-tb; caption-side: top; box-sizing: content-box; orphans: 2; widows: 2; page-break-inside: auto; empty-cells: show; background-image: none; background-attachment: scroll; background-repeat: repeat; background-position-x: 0%; background-position-y: 0%; background-color: rgb(255, 255, 255);"
contentEditable="true" onload="loaded=true;">
HTML structure(in Developer tools on selecting the input field this code gets selected) Using ID the element is not found. How to find the input field using xpath?

Pardon me if there are any mistakes in my question.

1 Answer 1

1

I'm using the Java-binding of Selenium

You need to switch to the iframe first

WebElement iframe = driver.findElement(By.id("Name_IF"));
driver.switchTo().frame(iframe);

WebElement inputElement = driver.findElement(By.id("Name"));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.