jeudi 18 février 2021

Java Selenium Click on the last Link "Details" with text "Open"

***Hi, Everyone!

I'd like to click every time on the Last element called "Details" with Status "Open", which is dynamically changing every day. How can I Achieve that:enter image description here I got this solution, but it's not working all the time:

String actualString = driver.findElement(By.xpath("//a[contains(.,'Details')]")).getText();
        Assert.assertTrue(actualString.contains("Details"));
        System.out.println("Details is Displayed");
        Thread.sleep(3000);
        driver.findElement(By.xpath("//a[contains(text(),'Details')][last ()]")).click();

I would really appreciate some help Thank you Jim***

Aucun commentaire:

Enregistrer un commentaire