个人代码:
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
public class Example {
public static void test(WebDriver driver) throws InterruptedException {
String nowXpath=””;
String inputValue=””;
//打开 页
driver.manage().window().maximize();
driver.get(“https://nj.zu.anjuke.com/”);
//1
driver.findElement(By.xpath(“/html/body/div[2]/div/ul/li[4]/a”)).click();
Thread.sleep(300);
//2
driver.findElement(By.xpath(“//*[@id=”switch_apf_id_5″”]/i””)).click();
driver.findElement(By.xpath(“”//*[@id=””city_list””]/dl[2]/dd/a[4]””)).click();
Thread.sleep(300);
//3
driver.findElement(By.xpath(“”/html/body/div[4]/ul/li[2]/a””)).click();
Thread.sleep(300);
//4
driver.findElement(By.xpath(“”/html/body/div[5]/div[2]/div[1]/span[2]/div/a[3]””)).click();
Thread.sleep(300);
//5
driver.findElement(By.xpath(“”/html/body/div[5]/div[2]/div[1]/span[2]/div/div/a[20]””)).click();
Thread.sleep(300);
//6
nowXpath = “”//*[@id=””from-price””]””;
inputValue = “”5000″”;
driver.findElement(By.xpath(nowXpath)).click();
driver.findElement(By.xpath(nowXpath)).clear();
driver.findElement(By.xpath(nowXpath)).sendKeys(inputValue);
//6
nowXpath = “”//*[@id=””to-price””]””;
inputValue = “”8000″”;
driver.findElement(By.xpath(nowXpath)).click();
driver.findElement(By.xpath(nowXpath)).clear();
driver.findElement(By.xpath(nowXpath)).sendKeys(inputValue);
//6
driver.findElement(By.xpath(“”//*[@id=””pricerange_search””]””)).click();
Thread.sleep(300);
//7
driver.findElement(By.xpath(“”/html/body/div[5]/div[2]/div[4]/span[2]/a[2]””)).click();
Thread.sleep(300);
//8
driver.findElement(By.xpath(“”//*[@id=””condmenu””]/ul/li[2]/a””)).click();
Thread.sleep(300);
//8
driver.findElement(By.xpath(“”//*[@id=””condmenu””]/ul/li[2]/ul/li[2]/a””)).click();
Thread.sleep(300);
//9
nowXpath = “”//*[@id=””search-rent””]””;
inputValue = “”经天路””;
driver.findElement(By.xpath(nowXpath)).click();
driver.findElement(By.xpath(nowXpath)).clear();
driver.findElement(By.xpath(nowXpath)).sendKeys(inputValue);
driver.findElement(By.xpath(“”//*[@id=””search-button””]””)).click();
Thread.sleep(300);
//10
driver.findElement(By.xpath(“”//*[@id=””list-content””]/div[1]/a[2]””)).click();
Thread.sleep(300);
//11
driver.findElement(By.xpath(“”//*[@id=””list-content””]/div[2]/div/a[2]””)).click();
Thread.sleep(300);
driver.findElement(By.xpath(“”//*[@id=””list-content””]/div[2]/div/a[3]””)).click();
Thread.sleep(300);
//12
driver.findElement(By.xpath(“”//*[@id=””list-content””]/div[3]””)).click();
Thread.sleep(1000);
}
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
try { test(driver); }
catch(Exception e) { e.printStackTrace(); }
finally { driver.quit(); }
}
}
相关资源:塞班s60v1和v2软件游戏sis解压工具
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!