Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Created February 28, 2016 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelovstanton/90e13fca3caba0e0530a to your computer and use it in GitHub Desktop.
Save angelovstanton/90e13fca3caba0e0530a to your computer and use it in GitHub Desktop.
[TestMethod]
public void SetHiddenField()
{
////<input type="hidden" name="country" value="Bulgaria"/>
IWebElement theHiddenElem = driver.FindElement(By.Name("country"));
string hiddenFieldValue = theHiddenElem.GetAttribute("value");
Assert.AreEqual("Bulgaria", hiddenFieldValue);
((IJavaScriptExecutor)driver).ExecuteScript(
"arguments[0].value='Germany';",
theHiddenElem);
hiddenFieldValue = theHiddenElem.GetAttribute("value");
Assert.AreEqual("Germany", hiddenFieldValue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment