I am new to protractor, and I am struggling to compare the values in if condition, I am not sure what I am missing. Please check my spec and let me know what I need to do.
Spec.js:
browser.driver.findElements(by.css('classname')).then(function (list) {
pageCounts = list.length;
for (var pageIndex = 0; pageIndex < pageCounts; pageIndex++)
{
pageName[pageIndex] = list[pageIndex].getText();
list[pageIndex].click();
}
if (pageCounts > 1) {
browser.driver.findElements(by.xpath('xpath')).then(function (totalPages) {
for (var menulength = 1; menulength < totalPages.length; menulength++){
menuPath[menulength] = browser.driver.findElement(by.xpath('xpath'));
menuPath[menulength].getText().then(function (menu) {
for (var menuIndex = 0; menuIndex < pageCounts; menuIndex++) {
if (menu === pageName[menuIndex]) {
browser.driver.findElement(by.xpath('')).click();
}
else
{
browser.driver.findElement(by.xpath('')).click();
}
}
}
});
It never goes into the loop if (menu === pageName[menuIndex])
.
Aucun commentaire:
Enregistrer un commentaire