TestInChrome1 throws me an exception - "OpenQA.Selenium.ElementNotInteractableException: element not interactable" However, when JavaScriptExecutor is used in TestInChrome2, it works well.
My questions are:
why does Click() method is not working in TestInChrome1?
how do can we determine that JavaScriptExecutor is necessary without trial and errors?
[TestMethod] public void TestInChrome1() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("https://ultimateqa.com/"); IWebElement element = driver.FindElement(By.TagName("title")); element.Click(); driver.Quit(); } [TestMethod] public void TestInChrome2() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("https://ultimateqa.com/"); IWebElement element = driver.FindElement(By.TagName("title")); IJavaScriptExecutor js = (IJavaScriptExecutor)driver; string title = (string)js.ExecuteScript("return document.title"); driver.Quit(); }