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

Misleading error message on isElementPresent with invalid selector in ptor.isElementPresent call #1068

Closed
amagee opened this issue Jul 14, 2014 · 6 comments

Comments

@amagee
Copy link

amagee commented Jul 14, 2014

Notice the invalid xpath selector "[href='/'".

If I do something like this:

expect(element(by.css("[href='/'")).isPresent()).toBeTruthy();

I get a quite sensible error message saying "The given selector [href='/' is either invalid or does not result in a WebElement.".

However if I do this:

browser.wait(function() { 
  return ptor.isElementPresent(by.css("[href='/'"));
});

the error message says "TypeError: Unimplemented function: "isPending"", which is quite confusing and unhelpful.

@hankduan
Copy link
Contributor

This is related to #1021. Basically webdriver treats the ElementFinder object as a promise because it has a then. However, we did not implement isPending. The solution to this is to simply add

ElementFinder.prototype.isPending = function() {
  return false;
}

However, since this is just an annoyance and not a blocker, I'm trying to wait for this first. #1066

@jiangmingxia
Copy link

We also got "TypeError: Unimplemented function: "isPending" when waiting for an element from Firefox. The fix of this issue is important to us.

@ashaffer
Copy link

ashaffer commented Aug 8, 2014

+1. Just ran into this issue myself. (the unimplemented function isPending error, that is)

@hankduan
Copy link
Contributor

hankduan commented Aug 8, 2014

should be fixed in #1179. Same issue as #1021

@hankduan
Copy link
Contributor

committed with 0da1e0c. Should be fixed. Can you try it again (against master)?

@hankduan hankduan self-assigned this Aug 19, 2014
@juliemr
Copy link
Member

juliemr commented Sep 4, 2014

I'm cleaning up the issues by closing old ones that haven't had responses in a while. Please open a new issue if you feel there is still a problem, or ask on Stack Overflow if your issue is actually a question.

@juliemr juliemr closed this as completed Sep 4, 2014
@hankduan hankduan removed their assignment Nov 4, 2015
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

5 participants