- Common ways to obtain FirefoxDriver
private void myMethod () {FirefoxDriver f =
new FirefoxDriver()
Capabilities desiredCapabilities;new FirefoxDriver(desiredCapabilities)
FirefoxOptions options;new FirefoxDriver(options)
- Smart code suggestions by Codota
}
FirefoxDriver _driver = new FirefoxDriver(); // create webdriverwait WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(10)); // create flag/checker bool result = false; // wait for the element. IWebElement elem = wait.Until(x => x.FindElement(By.Id("Element_ID"))); do { try { // let the driver look for the element again. elem = _driver.FindElement(By.Id("Element_ID")); // do your actions. elem.SendKeys("text"); // it will throw an exception if the element is not in the dom or not // found but if it didn't, our result will be changed to true. result = !result; } catch (Exception) { } } while (result != true); // this will continue to look for the element until // it ends throwing exception.