I wonder that
for(int k=1; k<4; k++){
String elem1 = driver.findElement(By.xpath("/html/body/div[4]/div/div/div[2]/div/div/div/div[3]/div[2]/div[2]/div[2]/ul[1]/li[6]/div/ul/li/div/a[k]" + k)).getAttribute("innerHTML");
//String elem2 = driver.findElement(By.xpath("/html/body/div[4]/div/div/div[2]/div/div/div/div[3]/div[2]/div[2]/div[2]/ul[1]/li[6]/div/ul/li/div/a[2]")).getAttribute("innerHTML");
//String elem3 = driver.findElement(By.xpath("/html/body/div[4]/div/div/div[2]/div/div/div/div[3]/div[2]/div[2]/div[2]/ul[1]/li[6]/div/ul/li/div/a[3]")).getAttribute("innerHTML");
System.out.println(elem1);
//System.out.println(elem2);
//System.out.println(elem3);
Thread.sleep(3000);
double value = Double.parseDouble(elem1);
System.out.println(value);
}
As you can see in "String elem1" line; i try to pass value k into xpath, but it doesnt work. How can i do that? I need to increase the value of k because as you can see in comments line it goes; 1-2-3-4....-78... Please help me, thank you all :)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire