-1

When I send data to a searchfield on a listpage a ElementNotInteractableException is thrown although a click in the same field just before sending this data is succesfull, with a blinking cursor in the field as a result. How is it possible that clicking on the field is succesfull but Sendkeys not?

public void SearchForBranch(string branch)
{
    Driver.WaitAndClick(SearchBranch);
    SearchBranch.SendKeys(branch);
    SearchBranch.SendKeys(Keys.Enter);
}
Zoeken _search_ _add_
Frank
  • 831
  • 1
  • 11
  • 23

1 Answers1

1

I know the issue. This is because the web element is in a state where it cannot click or cause any action. Example fee: hidden or unvisible. Use the IJavaScriptExecutor.

IJavaScriptExecutor driver1 = (IJavaScriptExecutor)driver;
IWebElement resElement = driver.FindElement(By.Id("g-recaptcha-response"));
driver1.ExecuteScript("document.getElementById('g-recaptcha-response').style.display='block'");

If you know the javascript,it will be good example.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352