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

Bug - browser.d.ts isElementPresent using ProtractorBy instead of Locator #3864

Closed
matenwego opened this issue Dec 21, 2016 · 2 comments
Closed
Assignees

Comments

@matenwego
Copy link

Just started converting our older Protractor tests to start using TypeScript and I noticed I was getting errors when using browser.isElementPresent(by.css('example-css')) saying that it should be a type of ProtractorBy.

I'm pretty sure this is supposed to be Locator like it is in the element.d.ts file.

I'm using protractor version 4.0.13. And looking at 4.0.14 doesn't look like that was updated to match either.

If I'm wrong please let me know what I should be using for browser.isElementPresent or should I just abstain from using that and using element(by.id('parent-element')).isElementPresent(by.css('example-css'). Going to continue to see if I can actually get the element(by.id('parent-element')).isElementPresent(by.css('example-css') working.

@sjelin
Copy link
Contributor

sjelin commented Dec 22, 2016

  1. That does sound wrong
  2. When investigating this bug, I discovered that browser.isElementPresent was broken for raw WebDriver elements (e.g. browser.isElementPresent(browser.driver.findElemet(by.id('my-elem'))) would fail). It will be fixed with fix(isElementPresent): for un-wrapped WebElements, browser.isElementPresent was broken #3871, which will also fix your typing issue.

sjelin added a commit to sjelin/protractor that referenced this issue Dec 22, 2016
@matenwego
Copy link
Author

Awesome thank you!

For now I did end up using a element(by.tagName('body')).isElementPresent(by.css('example')) in case anyone encounters this issue before the fix is in.

sjelin added a commit to sjelin/protractor that referenced this issue Dec 22, 2016
cnishina pushed a commit that referenced this issue Dec 22, 2016
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