Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public void setHiddenField() {
//<input type="hidden" name="country" value="Bulgaria"/>
var theHiddenElem = driver.findElement("country"));
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
javascriptExecutor.executeScript("arguments[0].value='Germany';", theHiddenElem);
String hiddenFieldValue = theHiddenElem.getAttribute("value");
Assert.assertEquals("Germany", hiddenFieldValue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment