2017-05-17 12 views
0

この参照してください:私はこのケースではそうWebDriverWaitを使用して別の要素のセレンから要素を取得する方法?

IWebElement webElement.. 
IWebElement webElement e = webElement.FindElement(By.XPath("my selector")); 

IWebDriver driver; 
WebDriverWait WebDriverWait; 

public IWebElement Button 
{ 
    return new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("bla bla"))); 
} 

は、今の場合には、私はいくつかのIWebElementを検索したいではなくdriver.FindElementの私は、私は次の操作を行うことができ、別のIWebElementを使用したいがwebElement.FindElementの代わりにWebDriverWaitを使用します。

可能ですか?

答えて

2

WebDriverWait.Until()戻りIWebElement、あなたは変数に返された値を割り当てるか、単に

IWebElement element = new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("bla bla"))); 
element.FindElement((By.XPath("my selector")); 

new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("bla bla"))).FindElement(By.XPath("my selector")); 
と同じです別の方法をCONCATすることができます
関連する問題