在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ Python/ 下拉框交互
log4j日志
Selenium IDE測試創(chuàng)建
Selenium - IDE模式匹配
Selenium教程
多瀏覽器測試
Selenium IDE下載
Selenium用戶擴展
鍵盤操作
捕捉屏幕截圖
Selenium網格
Selenium TestNG
Selenium定位器
查找所有鏈接
Selenium測試設計技術
鼠標操作
下拉框交互
Selenium IDE驗證點
Selenium IDE- 不同的瀏覽器
Selenium RC
多選擇操作
復選框交互
單選按鈕互動
捕捉視頻
拖放
Selenium IDE 測試
Synchronization 同步
異常處理
Selenium 環(huán)境安裝設置
Selenium概述
用戶交互
Selenium Webdriver
Selenium IDE
Selenium頁面對象模型
Selenium IDE 工具特點
使用Excel數據驅動
Selenium - Selenese命令

下拉框交互

下拉交互

在本節(jié)中,我們將了解如何使用下拉框進行交互。我們可以用“selectByVisibleText'或'selectByIndex'或'selectByValue'的方法選擇一個選項。

讓我們明白,如何使用交互復選框 - http://www.calculator.net/interest-calculator.htmll。我們還可以檢查下拉框中選擇/啟用/可見。

selenium_ide_182
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class webdriverdemo
{
  public static void main(String[] args) throws InterruptedException
  {
	WebDriver driver = new FirefoxDriver();

	//Puts a Implicit wait, Will wait for 10 seconds before throwing exception
	driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);


	//Launch website
	driver.navigate().to("http://www.calculator.net/interest-calculator.htmll");
	driver.manage().window().maximize();
	 
    // Selecting an item from Drop Down list Box
	Select dropdown = new Select(driver.findElement(By.id("ccompound")));
	dropdown.selectByVisibleText("continuously");
	
	//  you can also use dropdown.selectByIndex(1) to select second element as index starts with 0.
	//  You can also use dropdown.selectByValue("annually");    
        
    System.out.println("The Output of the IsSelected " + driver.findElement(By.id("ccompound")).isSelected());
    System.out.println("The Output of the IsEnabled " + driver.findElement(By.id("ccompound")).isEnabled());
    System.out.println("The Output of the IsDisplayed " + driver.findElement(By.id("ccompound")).isDisplayed());
    
    driver.close(); 
 
   }
}

輸出

在執(zhí)行時,向下設置與指定的值與命令的輸出下拉顯示在控制臺中。

selenium_ide_184
 

上一篇:多選擇操作下一篇:log4j日志