vendredi 6 juillet 2018

Click on multiple links using WDIO, Node, Selenium

I'm currently trying to write a web testing script which clicks all the links within my side bar. The problem is the amount of links changes depending on what the user has access to/has turned on.

My side bar is called $('#side-menu-bar') and the li's inside of it have class $('.side-menu-item').

According to WDIO's API, I should be able to do:

it('should fetch menu links and visit each page', function () {
    links = $$('#side-menu-bar li a');

    links.forEach(function (link) {
       link.click();
    });
});

When run - this will click the first link as many times are there are li's in the $('#side-menu-bar').

I've read and applied lots of previous discussions and answers to questions similar to this, however none have worked. Is this do-able/easier with perhaps a different framework? Currently using Mocha with a standalone-selenium server.

Aucun commentaire:

Enregistrer un commentaire