Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
889 views
in Technique[技术] by (71.8m points)

c# - OpenQA.Selenium.ElementNotInteractableException : element not interactable

i was doing some test and when i run a test with a searcher that i already work for and this error appear

System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
  ----> OpenQA.Selenium.ElementNotInteractableException : element not interactable

then i tried to run a test that i knew that worked and when it was time to use the searcher, the same error appear, it's kinda weird because i don't see any diference in the HTML code, and the searcher does work if i enter to the page manually.

this is my code to manipulate the searcher:

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

public ConfigurationUsuario buscarTabla(string input_search)
{
       buscadorConfig.SendKeys(input_search);
       return new ConfigurationUsuario(driver);
}

Here is an example of any test that use it:

        usuario.clickConfiguration();
        System.Threading.Thread.Sleep(2000);
        
        configuracion.buscarTabla("041097");
        System.Threading.Thread.Sleep(2000);

And this is the HTML code for the searcher:

<div id="table_filter" class="dataTables_filter">
<label>Search:<input type="search" class="" placeholder="" aria-controls="table"></label>
</div>

To be honest i don't know why all of a sudden the searcher stop working in my test script, i have like 10 test that use it and know none of them works, i literally change anything , i don't know if the devs did but i hope you guys can help me.

question from:https://stackoverflow.com/questions/65893917/openqa-selenium-elementnotinteractableexception-element-not-interactable

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can use a more canonical Locator Strategy as follows:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...