2013-06-12 54 views
0

我通常使用這個 new Select(driver.findElement(By.id(「title」)))。selectByVisibleText(「Mr」); ,這工作非常好。使用WebElement(硒)選擇下拉框?

我移動更PageFactory方法 我定義WebElement

@FindBy(ID = 「標題」) 私人WebElement標題;

如何使用此選項在下拉框中選擇?

我嘗試使用這個 driver.findElement((By)title) 但是這並沒有給我selectByVisibleText的選項。

回答

0

你需要做你以前做的事情。 @FindBy表示法只是取代了driver.findElement命令的需要。要使用你需要做的選擇:

new Select(title).selectByVisibleText("Mr"); 
+0

感謝這工作就像一個魅力。 – user1564179