mercredi 20 novembre 2019

How to execude Javascript with codepcetion and get the retunred values

Is there any way of making this work ?

    $I->amOnPage('/');

    $I->wait(2);

    $I->executeJS('
        var theCookies = document.cookie.split(\';\');
        var aString = \'\';
        for (var i = 1 ; i <= theCookies.length; i++) {
            aString += i + \' \' + theCookies[i-1] + "\n";
        }
        return aString;
    ');

Besides the fact that i get an error thrown, would something like this be possible ?

Aucun commentaire:

Enregistrer un commentaire