I want to list all the items in my console form the popup
Here is my code
public class changeCurrency {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver = new FirefoxDriver();
driver.get("http://www.cleartrip.com/");
driver.findElement(By.xpath("//a[contains(@class,'listMenuLink currencyLink')]")).click();
List<WebElement> Currency_list = driver.findElements(By.xpath("//ul[contains(@class,'currencyCol')]"));
for(int i = 0; i< Currency_list.size();i++)
{
System.out.println(Currency_list.get(i).toString());
}
My output was
[[[FirefoxDriver: firefox on WINDOWS (de810f41-6237-47aa-bbbe-f40c977bb4e2)] -> xpath: //ul[contains(@class,'currencyCol')]], [[FirefoxDriver: firefox on WINDOWS (de810f41-6237-47aa-bbbe-f40c977bb4e2)] -> xpath: //ul[contains(@class,'currencyCol')]]]
2
[[[FirefoxDriver: firefox on WINDOWS (de810f41-6237-47aa-bbbe-f40c977bb4e2)] -> xpath: //ul[contains(@class,'currencyCol')]], [[FirefoxDriver: firefox on WINDOWS (de810f41-6237-47aa-bbbe-f40c977bb4e2)] -> xpath: //ul[contains(@class,'currencyCol')]]]
2
But i want to list like
Australian dollar
Euro
Hongkong dollar
Indian rupee
Like that could u please advice on this
...
package BDD;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.List;
/**
* Created by PRAKASH on 5/8/2015.
*/
public class cleartrip {
@Test
public void test()
{
WebDriver dr=new FirefoxDriver();
dr.get("http://www.cleartrip.com/");
dr.findElement(By.xpath("//*[@id='userAccountNav']/nav/ul/li[2]/a")).click();
List<WebElement> currencies=dr.findElements(By.xpath("//*[@id='userAccountNav']/nav/ul/li[2]//li/a"));
for(WebElement a:currencies)
{
System.out.println(a.getText());
}
}
}
...