lundi 2 mai 2016

How to select the previous column of a table based on the text of the next column using selenium webdriver?

I am trying to select the previous column of a webtable based on the text of the next column. Here is my code for(WebElement eachrow:noofrows ) { List col3=eachrow.findElements(By.xpath("//td[3]"));

for(WebElement text:col3)   
{
    String s1=text.getText();
    System.out.println(s1);
    if(s1==opt1)
    {
        driver.findElement(By.xpath("//td[2]")).click();
    }




}

    if(t.equals(choice1)||t.equals(choice2))
    {
        text.findElement(By.xpath("//td[2]")).click();
    }

Here is a copy of the dom

Here is a copy of the dom

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire