求知 文章 文库 Lib 视频 iPerson 课程 认证 咨询 工具 讲座 Model Center   模型库  
会员   
 


基于 UML 和EA进行分析设计
7月30-31日 北京+线上



大模型核心技术RAG、MCP与智能体实践
8月14-15日 厦门



图数据库与知识图谱
8月23日-24日 北京+线上
 
 
  Selenium鏁欑▼
Selenium姒傝堪
Selenium IDE
Selenium IDE涓嬭浇
Selenium IDE 宸ュ叿鐗圭偣
Selenium IDE娴嬭瘯鍒涘缓
Selenium IDE娴嬭瘯
Selenium IDE楠岃瘉鐐
Selenium - IDE妯″紡鍖归厤
Selenium鐢ㄦ埛鎵╁睍
Selenium IDE- 涓嶅悓鐨勬祻瑙堝櫒
Selenium 鐜瀹夎璁剧疆
Selenium RC
Selenium - Selenese鍛戒护
Selenium Webdriver
Selenium瀹氫綅鍣
鏂囨湰妗嗙殑鐩镐簰浣滅敤
鍗曢夋寜閽簰鍔
澶嶉夋浜や簰
涓嬫媺妗嗕氦浜
Synchronization 鍚屾
鎷栨斁
閿洏鎿嶄綔
榧犳爣鎿嶄綔
澶氶夋嫨鎿嶄綔
鏌ユ壘鎵鏈夐摼鎺
Selenium娴嬭瘯璁捐鎶鏈
Selenium椤甸潰瀵硅薄妯″瀷
浣跨敤Excel鏁版嵁椹卞姩
log4j鏃ュ織
寮傚父澶勭悊
澶氭祻瑙堝櫒娴嬭瘯
鎹曟崏灞忓箷鎴浘
鎹曟崏瑙嗛
Selenium TestNG
Selenium缃戞牸
 
 

下拉框交互
1238 次浏览
11次  

下拉交互

在本节中,我们将了解如何使用下拉框进行交互。我们可以用“selectByVisibleText'或'selectByIndex'或'
selectByValue'的方法选择一个选项。

让我们明白,如何使用交互复选框 - http://
www.calculator.net/interest-calculator.htmll。我们还可以检查下拉框中选择/启用/可见。

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();

}
}

输出

在执行时,向下设置与指定的值与命令的输出下拉显示在控制台中。


您可以捐助,支持我们的公益事业。

1元 10元 50元





认证码: 验证码,看不清楚?请点击刷新验证码 必填



1238 次浏览
11次
 捐助