Selenium2.0?????????????λ
???????????? ???????[ 2013/10/9 16:23:02 ] ????????
????????????λ???????WebDriver?к????????????????λ??????????????У??????????????????????????????text????????????????WebDriver ????????????????????????????λ???web???:
???????????id???
???????????name???
???????????tag name ???
???????css xpath ???
???????xpath ???
???????class name ???
?????????????link text ??????
????????????link text ??????
package org.coderinfo.demo;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class FindSingleElements {
private static final String URL = "file:///C:/Desktop/Selenium/login.html"; // ??????????URL?????????login.html ?????·??
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize(); //???????????
driver.get(URL); //?????????? ?????????????
Thread.sleep(2000); //Wait for page load
driver.findElement(By.id("inputEmail")).sendKeys("coderinfo@163.com"); // use id to find a web element
Thread.sleep(2000);
driver.findElement(By.name("password")).sendKeys("#####"); // use name to find a web element
Thread.sleep(2000);
driver.findElement(By.cssSelector("#inputEmail")).clear(); // use css selector to find a web element
Thread.sleep(2000);
driver.findElement(By.linkText("UseLink")).click(); // use link text to find a web element
Thread.sleep(2000);
driver.findElement(By.partialLinkText("Use")).click(); // use partial link text to find a web element
Thread.sleep(2000);
String formClassName = driver.findElement(By.tagName("form")).getAttribute("class"); //use tag name to find a web element
System.out.println(formClassName);
Thread.sleep(2000);
String text = driver.findElement(By.xpath("/html/body/form/div[1]/div")).getText(); // use xpath to find a web element
System.out.println(text);
String inputText = driver.findElement(By.className("inputClass")).getAttribute("placeholder"); // use class name to find a web element
System.out.println(inputText);
Thread.sleep(5000);
driver.quit(); //???????WebDriver
}
}
|
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??????????????????????????????????????web?????????????????????????????????????Щ???棿???APP?????е??????????????????????????????????????????????????Web???????????????????Espresso????????????App??????????????????????????????2??????????????????????????1????????????????????????????δ??????????????????????????????????棩??????????????Hive???????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????