lundi 21 mars 2016

Selecting dropdown values using Selenium in java

I know this question has been asked plenty of times, I have tried all of the solutions that were on the other threads but I cannot get any to work, so hopefully someone can help here.

I am writing a Selenium test case and I have it working so far up to this problem. I think this should be very basic and easy to do, but for some reason I just can't get it to work. I am trying to select a value in a drop down list but I keep getting the following error when I try to select the value either by ID, XPath or link. This is the error -

Unable to locate element: {"method":"xpath","selector":".//*[@id='value_3']/a"}

This is my code for finding the element -

webdriver.findElement(By.xpath(".//*[@id='value_3']/a"));

Would anyone have any suggestions to try? I have also tried putting in a timer to ensure that everything is loaded on the page by doing this -

webdriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);      

but I still get the same error.

Aucun commentaire:

Enregistrer un commentaire