我收到错误'方法selectByVisibleText(String)未定义类型WebElement'

时间:2017-10-04 05:54:07

标签: java selenium selenium-webdriver

我在编码时收到此错误

The method selectByVisibleText(String) is undefined for the type WebElement

并且我也试图导入这个 - >

import org.openqa.selenium.support.ui.Select; 

但它失败了。代码如下,

new Select(driver.findElement(By.id("Service")).selectByVisibleText("Broadband"));
driver.findElement(By.cssSelector("input.AddBtnServiceAssignment")).click();

HTML代码:

<!--Wizard 1--> <tr> <td>select</td> <td>id=Service</td> <td>label=Broadband</td> </tr> <tr> <td>click</td> <td>css=input.AddBtnServiceAssignment</td> <td></td> </tr> <tr> 

0 个答案:

没有答案