Element is not currently visible and so may not be interacted with error with input field

49 views
Skip to first unread message

Nitin

unread,
Oct 2, 2015, 2:30:01 PM10/2/15
to Selenium Users
Hi All,

I am facing an issue with input field, though its identifier are very clear but script is not able to identify the element. It just throws an error "Element is not currently visible and so may not be interacted with"

Kindly find below the html of the element.

<td style ="padding-left:0px;"
 
<div id="divOTC">
     
<input id="OTCTEXT" class="textmediumFont" type="text" rte="yes" onekeyup="validateFieldOnKeyDown();" onfocus="clickOnOTC();" value="Please Enter Your One-Time-Code" name="OTCTEXT" maxlength="6" tabindex="1" style="display:block;"></input>
     
</div>
 
<input id="OTC" class="text" type="password" rte="yes" onkeyup="validateFieldOnKeyDown();" onblur="clickOutOTC()" onfocus="numerickeypad();" name="OTC" maxlength="6" onkeypress="{if(event.keyCode==13)validateOTC()}" tabindex="1" style="display:none;"> </input>
</td>

Till now I have tried

driver.findElement(By.id("OTCTEXT")).click();
driver.findElement(By.id("OTC")).sendKeys("");

I have used Javascriptexecutor and Action class also but it is not able to find driver.findElement(By.id("OTC"));

Kindly suggest the way to identify this element and send the OTC into it.Any help is really appreciated.

Regards,
Nitin



Shawn Knight

unread,
Oct 2, 2015, 3:25:44 PM10/2/15
to Selenium Users
first, your second input box is validating the first one -- {if(event.keyCode==13)validateOTC()}"  -- guessing if it doesn't validate correctly then the second will not show
and the second has  style="display:none;"> making it invisible to webdriver, again assuming when the first input box is validated correctly it will display.

Nitin

unread,
Oct 2, 2015, 10:55:09 PM10/2/15
to Selenium Users
How should I make sure that first input box is validated correctly every time sk that second input box is visible to the script.

Do I need to use robot class or Jquery to make it happen. Kindly advice.

Regards,
Nitin

Mark Collin

unread,
Oct 5, 2015, 7:02:01 AM10/5/15
to Selenium Users
Robot classes or jQuery are not going to help you here.  You need to input the correct data to make the second field appear.  I would suggest you then use an explicit wait to ensure that the second field has appeared before you try and interact with it.

The error you are getting is telling you that Selenium has found the field, but it's not yet visible.

Ripon Al Wasim

unread,
Oct 5, 2015, 7:14:48 AM10/5/15
to seleniu...@googlegroups.com
hi,
Have you tried with JS? If yes, what's the code you tried?

Ripon

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/9eb397a0-54b2-41a1-8822-bd3575594914%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages