/// <summary> /// Create an explicit wait for the element to become clickable and click it /// </summary> /// <param name="element"> /// An IWebElement to be awaited /// </param> /// <returns> /// True if element is clicked, false if it is not /// </returns> public virtual bool AwaitClick(SEBaseElement element) { try { WebDriverWait clickWait = new WebDriverWait(this, new TimeSpan(20 * TimeSpan.TicksPerSecond)); clickWait.Until(ExpectedConditions.ElementToBeClickable(element)); element.Click(); return(true); } catch { return(false); } }
/// <summary> /// Instantiate a SEChromeDriver with an implicit wait and always_open_pdf_externally plugin enabled /// </summary> public SEChromeDriver() : base(ChromeDriverService.CreateDefaultService(), new SEChromeOptions(), RemoteWebDriver.DefaultCommandTimeout) { // The constructor must be pointed to the chrome driver .exe // Or you must set a PATH variable pointing to the location // For SEChromeDriver, we rely on the PATH variable at C://program files//Chrome // Create an implicit wait for all requests to the web driver this.Manage().Timeouts().ImplicitWait = new TimeSpan(1 * TimeSpan.TicksPerSecond); // For the driver's document, we pass in the driver instead of an IWebElement. This is because // in most cases, the dom is manipulated after the page loads, which leads to stale reference exceptions. // By passing in the driver, we can locate the body element dynamically when necessary, and reset as necessary. this.Document = new SEBaseElement(this); }
private void reloadDocument() { this.Document = new SEBaseElement(this); }