Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
486 views
in Test Automation by
 
WebDriverWait wait = new WebDriverWait(driver,30);
 wait.until(ExpectedConditions.presenceOfElementLocated(By.id("number"))); 
    
 WebElement card_no = driver.findElement(By.id("number"));
    card_no.sendKeys("4000000000000101");
 
The card_no is a textbox visible to me.
But when I run I get Element Not visible Exception.

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

I can think of one possible scenario. It looks like you have layer on top of card_no. Check if card_no is under some other element. In that case, you will have to do send keys to that element and not to card_no.

 
by
Thanks Mayur For your answer.Solution is more similar to the one you have given.
There are two elements with the same id out of which 1 is not visible.This is poor design to have two elements with same id.

Thanks a lot.
Uday
by The go-to Tester (181 points)
Great. I am glad that it helped you out to identify root cause.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...