vendredi 5 juin 2020

Locate text in webpage and click - Eclipse Selenium

I want to locate some text in a webpage. This text is inside a list, and for each value of this list I need to locate the text in webpage and click in a button that belong to this value. This is my code:

List<String> lstFaturasAProcessar = new ArrayList<>();
for (String fatNumber : lstFaturasAProcessar) {
             if(driver.getPageSource().contains(fatNumber))
             driver.findElement(By.className("btn-default btn-small dropdown-trigger")).click();
}           

Basically I am saying, if the value of that list is present in webpage, click button. All the values of list have different buttons, and all the buttons have the same class name, but when It click button nothing happens. Buttons' HTML:

<button type="button" class="btn-default btn-small dropdown-trigger">
                <span>Obter documentos<i class="icon2-arrow-down"></i></span>
              </button>

Can you help me?




Aucun commentaire:

Enregistrer un commentaire