单选按钮互动
我们可以使用“click”方法来实现单击操作,直接看代码.
import java.util.concurrent.TimeUnit; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; public class webdriver { public static void main(String[] args) throws InterruptedException { WebDriver driver = new FirefoxDriver(); driver.get("http://www.calculator.net/mortgage-payoff-calculator.htmll"); driver.manage().window().maximize(); driver.findElement(By.id("455461")).click(); System.out.println("The Output of the IsSelected " + driver.findElement(By.id("cpayoff1")).isSelected()); System.out.println("The Output of the IsEnabled " + driver.findElement(By.id("cpayoff1")).isEnabled()); System.out.println("The Output of the IsDisplayed " + driver.findElement(By.id("cpayoff1")).isDisplayed()); driver.close(); } }
在执行时,被选中的单选按钮和命令的输出显示在控制台中。
还没有评论,来说两句吧...