package test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;
public class lesson7 {
@Test
public void test() throws InterruptedException{
System.setProperty(“webdriver.chrome.driver”, “D:/01 Learn WebDriver/chromedriver.exe”);
WebDriver dr = new ChromeDriver();
dr.manage().window().maximize();
dr.get(“http://tieba.baidu.com/f/search/adv?red_tag=o2706168053”);
Thread.sleep(2000);
//下拉框处理
Select s1 = new Select(dr.findElement(By.name(“rn”)));
//s1.selectByIndex(1);
//s1.selectByValue(“30”);
s1.selectByVisibleText(“每页显示20条”);
//dr.quit();
}
}
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/195773.html