Clicking a hidden radiobutton, surely there is a better way?

5 views
Skip to first unread message

Linus Nikander

unread,
Oct 1, 2016, 5:58:44 AM10/1/16
to Selenium Users
I have a form with a radiobutton which looks like this:


Now, this isn't a normal radiobutton rather implemeted as follows:


I can't fire normal .click() events since it will tell me the element isn't visible (css below).



The click event is captures as below.



Right now I'm doing this

List<WebElement> radioBtnList = driver.findElementsByName("orderWhenOption");

WebElement buttonToSelect = radioBtnList.get(0);


JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click();", buttonToSelect);


is there a better way?






Reply all
Reply to author
Forward
0 new messages