vendredi 8 avril 2016

Selecting a item of a table? with Selenium

I'm tryng to select a item ( the first phone, whatever it is) in the o2 web page. I'm in http://ift.tt/POTRGq, I select the paymonthly tab, but I'm not able to select the first phone in the list, I'm trying doing:

        List<WebElement> linkElements = driver.findElements(By.className("tab-contents"));
    String[] linksText = new String[linkElements.size()];
    int index = 0;
    for(WebElement element : linkElements){

        linksText[index++] = element.getText();
        if(index==1){
            element.click();
        }
    }

But it's not running. Anyone can help me ? I'm learning how to use selenium, therefore, I dont have many experience in it. Sorry if that is so easy to ask.

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire