jeudi 21 février 2019

How to click a button in selenium with java without name or ID

How can i use selenium to click this button?

 <button type="submit" class="button--primary button button--icon button--icon--login"><span class="button-text">Log in</span></button>

I have tried these

    driver.findElement(By.className("button--primary button button--icon button--icon--login")).click();
    driver.findElement(By.xpath("//button[contains(@class='button--primary button button--icon button--icon--login')]")).click();
    driver.findElement(By.xpath("//span/button[text()='Log in' and @class='button']")).click();
    driver.findElement(By.xpath("//span/button[text()='Log in'][1]")).click();

but no avail, help!




Aucun commentaire:

Enregistrer un commentaire