Reputation: 51
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): http://pretraga2.apr.gov.rs/ObjedinjenePretrage/Search/Search http://www.nbs.rs/internet/english/67/rir.html
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.
Upvotes: 1
Views: 3100
Reputation: 21
this can also happen occasionally when the element is not visible without scrolling (but I don't know exactly why although the element in my case not is hidden) I found the solution is to move the focus to the element before call the action required (click,sendKeys, etc)
Actions actions = new Actions(driver);
actions.moveToElement(webElement).perform();
Upvotes: 0
Reputation: 16201
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.
td.apr-mbr>[name='SearchByRegistryCodeString']
Edit:
This code works just fine on first link.
WebElement element = driver.findElement(By.cssSelector("td.apr-mbr>[name='SearchByRegistryCodeString']"));
element.sendKeys("Test");
Upvotes: 2