b02 b02 - 1 year ago 167
Java Question

Java - Selenium (chrome driver) element not visible exception

I have 2 websites that i would like to automate search process, and i am struggling of finding a way to locate and fill elements and speed up the process(as i use these websites many times a day):

I tried almost everything, and managed to locate the text field "Матични број:" on the first website, but when trying to fill it i get element not visible exception.
The second site i tried triggering javascript but it opens the form for search in new window, and the search cant be made from there.

Hopefully someone will come up with some kind of solution, thanks in advance.

Answer Source

There are exactly two elements with same id and names. If you carefully investigate you will see the second element is the one you want.



This code works just fine on first link.

WebElement element = driver.findElement(By.cssSelector("td.apr-mbr>[name='SearchByRegistryCodeString']"));

enter image description here