Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.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# OpenQA.Selenium.ElementNotInteractitableException:元素不可交互_C#_Visual Studio_Selenium_Selenium Webdriver_Css Selectors - Fatal编程技术网

C# OpenQA.Selenium.ElementNotInteractitableException:元素不可交互

C# OpenQA.Selenium.ElementNotInteractitableException:元素不可交互,c#,visual-studio,selenium,selenium-webdriver,css-selectors,C#,Visual Studio,Selenium,Selenium Webdriver,Css Selectors,我正在做一些测试,当我运行一个我已经为之工作的测试时,出现了这个错误 System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> OpenQA.Selenium.ElementNotInteractableException : element not interactable 然后我试着运行一个我知道有效的测试,当使用搜索程

我正在做一些测试,当我运行一个我已经为之工作的测试时,出现了这个错误

System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
  ----> OpenQA.Selenium.ElementNotInteractableException : element not interactable
然后我试着运行一个我知道有效的测试,当使用搜索程序时,同样的错误出现了,这有点奇怪,因为我在HTML代码中没有看到任何差异,如果我手动进入页面,搜索程序确实有效

这是我操纵搜索者的代码:

[FindsBy(How = How.CssSelector, Using = "input")]
private IWebElement buscadorConfig;

public ConfigurationUsuario buscarTabla(string input_search)
{
       buscadorConfig.SendKeys(input_search);
       return new ConfigurationUsuario(driver);
}
<div id="table_filter" class="dataTables_filter">
<label>Search:<input type="search" class="" placeholder="" aria-controls="table"></label>
</div>
以下是使用它的任何测试的示例:

        usuario.clickConfiguration();
        System.Threading.Thread.Sleep(2000);
        
        configuracion.buscarTabla("041097");
        System.Threading.Thread.Sleep(2000);
这是搜索者的HTML代码:

[FindsBy(How = How.CssSelector, Using = "input")]
private IWebElement buscadorConfig;

public ConfigurationUsuario buscarTabla(string input_search)
{
       buscadorConfig.SendKeys(input_search);
       return new ConfigurationUsuario(driver);
}
<div id="table_filter" class="dataTables_filter">
<label>Search:<input type="search" class="" placeholder="" aria-controls="table"></label>
</div>

搜索:

老实说,我不知道为什么搜索者突然停止在我的测试脚本中工作,我有10个测试使用它,并且知道它们都不起作用,我真的改变了什么,我不知道开发人员是否做了,但我希望你们能帮我。

你们可以使用更规范的方法,如下所示:

[FindsBy(How = How.CssSelector, Using = "input[aria-controls='table'][type='search']")]
private IWebElement buscadorConfig;