dimanche 15 novembre 2020

how to change value in selenium List

i am trying to get a value from List and then change the value if its not what i expect. Please see my below code, is there any way i could change a list value? what i am doing is not working:


try {
    public static List<WebElement> nextPage_02 = driver.findElements(By.xpath("//a[contains(@href,'=sr_pg_')]"));
                for(WebElement g : nextPage_02) {
                    if(g.getText().equals("someText")) {
                        g.getText().replaceAll("someText", "2") ;
                        int nextPageToInt = Integer.parseInt(g.getText());
                        }
                    }

Aucun commentaire:

Enregistrer un commentaire