JAVA Script Executor Code to Click on an Element
Click on an Element in Selenium WebDriver
Sometimes click() method does not work because two views are loaded at the same time on a page. In this case, we can use the JavascriptExecutor to get the work done.
Below is code to click on an element using Javascript Executor.
Below is code to click on an element using Javascript Executor.
1 2 3 4 5 6 7 | @FindBy(id = Checkbox.financialAssistanceAccountEmailId) public WebElement financialAssistanceAccountEmail; //Click to element JavascriptExecutor executor = (JavascriptExecutor) driver; executor.executeScript("arguments[0].click()", financialAssistanceAccountEmail); |
Comments
Post a Comment