Reputation: 3304
I am getting error while entering text into hidden fields using .sendkeys()
in web automation using selenium and chrome driver.
I got one similar question here, but I am not getting how to implement it in .Net
How to do it ?
I am using vb.net but c# is also OK for me.
Upvotes: 0
Views: 2444
Reputation: 5127
As far as I know, you have to use IJSExecutor. See an example below:
string script = "arguments[0].setAttribute('value', arguments[1]);"
IWebElement theHiddenField = driver.FindElement(By.Id("the-hidden-field"));
((IJavaScriptExecutor)driver).ExecuteScript(script, theHiddenField, "here is new value");
Upvotes: 2