selenium-java-demo
selenium-java-demo
Selenium Ban Ben
pom.xmlWen Jian Zhong ,Ban Ben Xuan 2.53.1 ,Bu Yao Xuan 3.x,Fou Ze Bao Cuo
org.seleniumhq.selenium
selenium-java
2.53.1
FirefoxBan Ben
27~46
Tong Guo Xia Mian De Dai Ma Pei Zhi FirefoxDe An Zhuang Lu Jing :
@Before
public void setUp() throws Exception
System.setProperty("webdriver.firefox.bin", "D:\\Firefox\\firefox.exe");
driver = new FirefoxDriver();
baseUrl = "https://www.baidu.com/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
ChromeDriverBan Ben (Shi Bai ,Huan Mei You You Zhao Dao Yuan Yin )
v2.9.248315 on port 23485
Ding Wei Fang Shi
com.coderdream.selenium.Baidu.java
| Yong Li | Fang Shi | Shi Yong Cha Jian |
|---|---|---|
| testBaidu_01 | By.id("kw") | Firebug |
| testBaidu_02 | By.name("wd") | Firebug |
| testBaidu_03 | By.className("s_ipt") | Firebug |
| testBaidu_04 | By.linkText("Xin Wen ") | Firebug |
| testBaidu_05 | By.partialLinkText("Xin ") | Firebug |
| testBaidu_06 | By.xpath(".//*[@id='kw']") | Firepath(xpath) |
| testBaidu_07 | By.cssSelector("#kw") | Firepath(css) |
Biao Ge Ding Wei
Xian Tong Guo findElementZhao Dao Biao Ge ,Ran Hou Tong Guo findElementsZhao Dao Suo You tr,Zai Tong Guo findElementsZhao Dao Suo You td
WebElement table = driver.findElement(By.tagName("table"));
// findElementShi Ding Wei Dan Ge Yuan Su De Fang Fa
//table.findElement(By.tagName("tr"));
// findElementsShi Ding Wei Yi Zu Yuan Su De Fang Fa
String str1 = "Di Er Xing Di 2Lie ";
String str2 = "Di San Xing Di 6Lie ";
List trs = table.findElements(By.tagName("tr"));
for (WebElement tr : trs) {
List tds = tr.findElements(By.tagName("td"));
for (WebElement td : tds) {
//System.out.println(td.getText());
if(str1.equals(td.getText()) ||str2.equals(td.getText())) {
System.out.println(td.getText());
} else {
System.out.println("error");
}
}
}
Selenium-webdriverXue Xi Jiao Cheng
Di Zhi : http://jarvi.iteye.com/category/203994
package com.coderdream.selenium.jarvi
| Xu Hao | Zhu Ti | Lian Jie |
|---|---|---|
| Sample01 | Kuai Su Kai Shi | http://jarvi.iteye.com/blog/1447389 |
| Sample02 | Dui Liu Lan Qi De Jian Dan Cao Zuo | http://jarvi.iteye.com/blog/1447672 |
| Sample03 | Zhi Xing jsJiao Ben | http://jarvi.iteye.com/blog/1447755 |
| Sample04 | Ding Wei Ye Mian Yuan Su | http://jarvi.iteye.com/blog/1448025 |
| Sample05 | iframeDe Chu Li | http://jarvi.iteye.com/blog/1450525 |
| Sample06 | Ru He De Dao Dan Chu Chuang Kou | http://jarvi.iteye.com/blog/1450626 |
| Sample07 | Ru He Chu Li alert, confirm, promptDui Hua Kuang | http://jarvi.iteye.com/blog/1450750 |
| Sample08 | Ru He Cao Zuo selectXia La Kuang | http://jarvi.iteye.com/blog/1450883 |
| Sample09 | Ru He Cao Zuo cookies | http://jarvi.iteye.com/blog/1451019 |
| Sample10 | Ru He Ba Yi Ge Yuan Su Tuo Fang Dao Ling Yi Ge Yuan Su Li Mian (Wei Shi Xian ) | http://jarvi.iteye.com/blog/1452220 |
| Sample11 | Ru He Deng Dai Ye Mian Yuan Su Jia Zai Wan Cheng | http://jarvi.iteye.com/blog/1453662 |
| Sample12 | Ru He Li Yong selenium-webdriverJie Tu | http://jarvi.iteye.com/blog/1464169 |
| Sample13 | Ru He Li Yong ActionsLei Mo Ni Shu Biao He Jian Pan De Cao Zuo | http://jarvi.iteye.com/blog/1468690 |
| Sample14 | Ru He Chu Li table | http://jarvi.iteye.com/blog/1477837 |
| Sample15 | Ru He Chu Li FirefoxProfile(You Wen Ti ) | http://jarvi.iteye.com/blog/1482064 |
Send Mail Cuo Wu
javax.mail.AuthenticationFailedException: 535 Error: authentication failed