When i use this code to click a value in the dropdown list, the following error occurs:
FAILED because (of) org.openqa.selenium.WebDriverException: unknown error: document.getElementsByTagName(…).click is not a function
((JavascriptExecutor) DriverFactory.getWebDriver()).executeScript(“document.getElementsByTagName(‘li:contains(Eastern Standard Time)’).click()”)
Actually, For the previous drop down options, I used ‘click’ keyword and it worked fine. For this particular drop down, the list opens up but I couldn’t able to click the option, that’s the reason why I used javascript for that.
Can you suggest any other solution??
1 Like
Your script is incorrect. By the way, why do you need to execute javascript to click on a dropdown list? Basically, you can just use ‘Click’ keyword and pass in your dropdown list object.