Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用selenium和chrome驱动程序在.net的隐藏字段中键入文本_C#_Google Chrome_Selenium_Selenium Chromedriver_Webautomation - Fatal编程技术网

C# 如何使用selenium和chrome驱动程序在.net的隐藏字段中键入文本

C# 如何使用selenium和chrome驱动程序在.net的隐藏字段中键入文本,c#,google-chrome,selenium,selenium-chromedriver,webautomation,C#,Google Chrome,Selenium,Selenium Chromedriver,Webautomation,使用.sendkeys() 在web自动化中使用selenium和chrome驱动程序 我这里有一个问题,但我不知道如何在.Net中实现它 怎么做 我正在使用vb.net,但c对我来说也可以。据我所知,您必须使用ijsecutor。请参见下面的示例: string script = "arguments[0].setAttribute('value', arguments[1]);" IWebElement theHiddenField = driver.FindElement(By.Id("t

使用
.sendkeys()
在web自动化中使用selenium和chrome驱动程序

我这里有一个问题,但我不知道如何在.Net中实现它

怎么做


我正在使用vb.net,但c对我来说也可以。

据我所知,您必须使用ijsecutor。请参见下面的示例:

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");

据我所知,你必须使用ijsecutor。请参见下面的示例:

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");

@Joucks No的可能重复项,这将删除字段和类型数据的隐藏功能。我还希望在.netw中使用另一种方法。您尝试了哪些方法,结果如何?请阅读有关如何提问的帮助主题。您需要研究自己的问题,找到代码示例等,并编写自己的代码来解决问题。如果你做了所有这些,但仍然无法理解,那么回来编辑你的问题,并添加你所做研究的注释,你尝试过的代码缩减为a,以及结果是什么。。。任何错误消息等。包括任何相关HTML并正确格式化HTML和代码也是非常重要的。可能存在@Joucks No的重复,这会删除字段和类型数据的隐藏功能。我还需要一个替代方法。NetW您尝试了什么,结果如何?请阅读有关如何提问的帮助主题。您需要研究自己的问题,找到代码示例等,并编写自己的代码来解决问题。如果你做了所有这些,但仍然无法理解,那么回来编辑你的问题,并添加你所做研究的注释,你尝试过的代码缩减为a,以及结果是什么。。。任何错误消息等。包括任何相关的HTML并正确格式化HTML和代码也是非常重要的。