Assertionerror: Expected False to Equal True

Here is the code:

this.Then(/^I click to the next button on the edit page$/,function(callback) {
    targetPO.getEditNextButton().isPresent().then(function(){
        targetPO.getEditNextButton().click().then(callback);
    });
})

I got the:

AssertionError: expected false to equal true

error. I can not find any useful tutorial, only saint tales.

What is the reason for the error?

Here is the getEditNextButton() function:

function getEditNextButton() {
    return element(by.id(selectors.editNextButton));
}
3

1 Answer

Looks like an issue with the way you are calling the function. It can be solved in two ways:
1) Either from function getEditNextButton(), you remove 'element' in the return element(by.id(selectors.editNextButton));

or

2) Since, by calling getEditNextButton() function, you are returning 'element(by.id(...)' .
So, You should remove element. from 'element.getEditNextButton().click().then(callback);'

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest