Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Should wrap webdriver's 'isElementPresent' #11

Closed
juliemr opened this issue Jun 24, 2013 · 2 comments
Closed

Should wrap webdriver's 'isElementPresent' #11

juliemr opened this issue Jun 24, 2013 · 2 comments

Comments

@juliemr
Copy link
Member

juliemr commented Jun 24, 2013

Currently, isElementPresent won't work with all protractor bindings.

@DimitarChristoff
Copy link

++ for that.

Slightly unrelated but probably not worth its own issue as fixing this will allow a fair amount of sugar...

Would be nice to get some methods like in CasperJS:

  • waitUntilElementIsGone (or waitWhileSelector etc)
  • waitUntilTextIs (or waitWhileTextIs)

etc etc. http://docs.casperjs.org/en/latest/modules/casper.html#waitwhileselector

Logically, seems like a combination of wait and find methods should be enough but... seems that the .wait(fn) does not quite work as expected and will iterate until true but does not seem to run .then or resume flow. protractor@#0.8.0

context:

// being able to wait for an element to disappear before doing something. exists initially
setTimeout(function(){
    // remove node after 2 sec   
    driver.executeScript(function() {
        var b = document.querySelector('.refresh-btn');
        b.parentNode.removeChild(b);
    });
}, 2000);

var gone;
ptor.wait(function(){
    gone = !ptor.isElementPresent(by.css('.refresh-btn'));
        gone || console.log('resolving at ' + +new Date); // runs a fair bit for 2 secs.
    return gone;
}).then(function(){
        console.log('never runs');
    expect(true).toBe(true);
});

// nope.
expect(false).toBeFalsy();

@juliemr juliemr closed this as completed in cfc6438 Sep 4, 2013
@DimitarChristoff
Copy link

cheers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants