In some cases if a button is hidden on a web page. We can enable or display that button using following method:
Here is the HTML code represents the button is hidden on web page.
input type="submit" name="HiddenButton" value="Download" onclick="return checknextpage();" language="javascript" id="HiddenButton" class="button" style="width:100px;display:none;"
Here is the java code to display or enable that button:
JavascriptExecutor js = (JavascriptExecutor) driver;
WebElement element = driver.findElement(By.id("HiddenButton"));
js.executeScript("arguments[0].setAttribute('style', 'width:100px')",element);
Comments
Post a Comment