1

I am not able to locate element of a textbox and it is showing "element is not visible" error.

I am using below code:

WebElement elem=webObj.findElement(By.xpath(".//*[starts-with(@id,'yui')]"));

String str="arguments[0].style.visibility='visible';";

((JavascriptExecutor) webObj).executeScript(str, elem);

elem.sendKeys("Test");

Please help

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
nick
  • 11
  • 1
  • Please add the HTML snippet of the element you want to locate. – Subh Sep 02 '15 at 09:51
  • Also try adding Wait statment or increase the time value if you have added one already to verify the presence of element Example : [Wait](http://stackoverflow.com/questions/12858972/how-can-i-ask-the-selenium-webdriver-to-wait-for-few-seconds-in-java) – Sriram Sep 02 '15 at 10:07
  • In general, you don't want to change the visibility of an element with code. You should do what a user would do to expose that element on the page... then you can interact with it. – JeffC Sep 02 '15 at 14:08

0 Answers0