jeudi 1 mars 2018

Generic code for clicking web element from a list in Python:

Here is my code in Java that I want to convert in Python:

public static void clickElementFromList(String ListObject, String strname) {

    List<WebElement> wbeElement;

    wbeElement = Util.findElements(ListObject);

    for (int cnt = 0; cnt < wbeElement.size(); cnt++) {
        if (wbeElement.get(cnt).getText().trim().contentEquals(strname)) {
            wbeElement.get(cnt).click();
            break;
        }
    }

}

//listobj is the web element. //strname is the displayed text in the application

Aucun commentaire:

Enregistrer un commentaire