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

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

用戶交互

文本框的相互作用

在本節(jié)中,我們將了解如何使用文本框交互。我們可以把值轉(zhuǎn)換成文本框中使用“SendKeys”方法,也使用getattribute("value")指令得到的文本文字?,F(xiàn)在讓我們來(lái)看看一個(gè)例子。

selenium_ide_177
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;

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/percent-calculator.htmll");
	
	//Maximize the browser
	driver.manage().window().maximize();

   	// Enter value 10 in the first number of the percent Calculator
    driver.findElement(By.id("cpar1")).sendKeys("10");
    
    Thread.sleep(5000);
	
    // Get the text box from the application
    String result = driver.findElement(By.id("cpar1")).getAttribute("value");
    
	//Print a Log In message to the screen
    System.out.println(" The Result is " + result);
    
	//Close the Browser.
    driver.close();    
  }
}

輸出

顯示上面的腳本的輸出如下所示。

selenium_ide_183
文本框的相互作用

下一篇:異常處理