Please see this:
IWebDriver driver;
WebDriverWait WebDriverWait;
public IWebElement Button
{
return new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("bla bla")));
}
Now in case I want to search some IWebElement
but instead of driver.FindElement
I want to use another IWebElement
I can do the following:
IWebElement webElement..
IWebElement webElement e = webElement.FindElement(By.XPath("my selector"));
So in this case I want to use WebDriverWait
to instead of just webElement.FindElement
.
Is it possible ?
WebDriverWait.Until()
returns IWebElement
, you can assign the returned value to a variable or just concat another method
IWebElement element = new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("bla bla")));
element.FindElement((By.XPath("my selector"));
Is the same as
new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("bla bla"))).FindElement(By.XPath("my selector"));
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments