Skip to content Skip to sidebar Skip to footer

Testing React Js Dropdown With Selenium And Java

I have a drop down, that populates values dynamically using React JS. How can I select a value from this dropdown. Can you point me in the right direction maybe with an example. he

Solution 1:

I also had the same issue and found a solution based on Saurabh's answer.

WebElementbutton= driver.findElement(element);

Actionsaction=newActions(driver);
action.moveToElement(button).click().build().perform();

Solution 2:

Use action class. Here is an example:

Actionsact=newActions(this.getDriver());
act.moveToElement(element).click().build().perform();
act.click(elementValue).build().perform();

Solution 3:

The standard selenium dropdown method has been working for me. There are other options such as selecting by index too if you don't care what year you are picking.

Select dropdown =newSelect(element)); 
dropdown.selectByVisibleText(year);

Post a Comment for "Testing React Js Dropdown With Selenium And Java"