Question

This is being done using angular 1.1.X

If there is a dom element that doesnt have a unique class or id how is one supposed to find it in order to do an element().click(); ?

is this something one would just use the full version of jquery for or is there a way to do it with angulars jqueryLite ?

ie if one has a list of links , how would you select the first element of the list using angular?

Was it helpful?

Solution

You can use generic jquery selectors to find elements.. here's some code from my e2e tests. Note especially the :eq(3) selector for taking the 4th anchor tag.

    it('The cancel button should close the form and revert the info', function() {
        input("ci.customer.name").enter("Tom Selleck")
        element('#customerinfo input[value="Cancel"]').click();
        // check pdfdata to make sure it got reflected
        element('.navbar a:eq(3)').click();
        expect(element('.navbar a:eq(2)').text()).not().toBe("Customer (Tom Selleck)");
    });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top