lamcpp
lamcpp

Reputation: 79

Selenium I can't send text in field. sendkeys didn't work

I have this code:

 <TD style="PADDING-BOTTOM: 2px; WIDTH: 100px" vAlign=top><LABEL class=REQUIRED_FIELD_LABEL>Identify Number </LABEL>
<OBJECT onblur=ftMaskEdit_NumerDOOnBlur(this) style="background-color: #dddddd; width: 100%; display: block; font-family: TAHOMA; margin-bottom: 1px; height: 20px; visibility: visible; font-size: 11px; top: 0px; left: 0px;" id=ftMaskEdit_1_NUMERDO class=FORM_TEXT_BOX classid=clsid:C932BA85-4374-101B-A56C-00AA003668DC VIEWASTEXT GroupID="PelneDaneWsp"><PARAM NAME="_ExtentX" VALUE="0"><PARAM NAME="_ExtentY" VALUE="50271"><PARAM NAME="_Version" VALUE="393216"><PARAM NAME="BorderStyle" VALUE="1"><PARAM NAME="ClipMode" VALUE="0"><PARAM NAME="MousePointer" VALUE="0"><PARAM NAME="Appearance" VALUE="1"><PARAM NAME="BackColor" VALUE="-2147483643"><PARAM NAME="ForeColor" VALUE="-2147483640"><PARAM NAME="PromptInclude" VALUE="-1"><PARAM NAME="AllowPrompt" VALUE="0"><PARAM NAME="AutoTab" VALUE="0"><PARAM NAME="HideSelection" VALUE="-1"><PARAM NAME="Enabled" VALUE="-1"><PARAM NAME="MaxLength" VALUE="64"><PARAM NAME="OLEDragMode" VALUE="0"><PARAM NAME="OLEDropMode" VALUE="0"><PARAM NAME="Mask" VALUE=">???######"><PARAM NAME="PromptChar" VALUE="_"></OBJECT></TD>

On the webpage is a text box where I can enter text manually. In this text the first,second and third positions must be a letters, and next 6 positions must be numbers eg. "ABC111111", "BBB222222". When i click on element focus is different. in my code:

System.out.println(driver.findElements(By.id("ftMaskEdit_1_NUMERDO")).size()); //1
    driver.findElement(By.id("ftMaskEdit_1_NUMERDO")).click();  
    System.out.println(driver.findElement(By.id("ftMaskEdit_1_NUMERDO")).isDisplayed()); //true
    System.out.println(driver.findElement(By.id("ftMaskEdit_1_NUMERDO")).isEnabled()); //true

when I try: driver.findElement(By.id("ftMaskEdit_1_NUMERDO")).clear(); I have got an error: NoSuchElement Exceptions Element must not be hidden, disabled or read-only

when I send keys:

driver.findElement(By.id("ftMaskEdit_1_NUMERDO")).click();
driver.findElement(By.id("ftMaskEdit_1_NUMERDO")).sendKeys(Keys.Home,"ABB111111')

nothing happen. I try use Robot, Action and JavaScript but I still can't send the text:( How can I send keys to this element?

Upvotes: 0

Views: 1106

Answers (1)

ddavison
ddavison

Reputation: 29092

The text box that you are attempting to interact with appears to be within an embedded object.

Selenium cannot automate anything within the <object> tag.. Selenium cannot automate any embedded elements like <object>, <embed>.

Upvotes: 1

Related Questions