Skip to content

SelectorAPI.getAttribute can return undefined but docs indicate it always returns a string #5984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kPepis opened this issue Feb 23, 2021 · 2 comments · Fixed by #6388
Closed
Assignees
Labels
FREQUENCY: level 1 TYPE: bug The described behavior is considered as wrong (bug).

Comments

@kPepis
Copy link

kPepis commented Feb 23, 2021

What is your Test Scenario?

Using SelectorAPI.getAttribute can return undefined for attributes that are not present in the current selector.

What is the Current behavior?

SelectorAPI.getAttribute's type indicates it returns Promise<string>.

What is the Expected behavior?

SelectorAPI.getAttribute should return Promise<string | undefined>.

Your complete test code (or attach your test files):
 const mySelector = Selector('a');
 const undefinedAttribute = mySelector.getAttribute('this-does-not-exist');
 const undefinedAttribute.trim(); // method does not exist
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Feb 23, 2021
@AlexanderMoiseev
Copy link
Contributor

Hello,

Thank you for pointing this out. We have reproduced this behavior and will fix it in the context of this thread. Please stay tuned.

@AlexanderMoiseev AlexanderMoiseev added FREQUENCY: level 1 TYPE: bug The described behavior is considered as wrong (bug). labels Feb 24, 2021
@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Feb 24, 2021
@AndreyBelym AndreyBelym added AREA: TypeScript definitions AREA: docs An issue related to the product documentation. and removed AREA: TypeScript definitions labels Jun 7, 2021
@AndreyBelym AndreyBelym added AREA: TypeScript definitions and removed AREA: docs An issue related to the product documentation. labels Jul 5, 2021
@AndreyBelym AndreyBelym assigned AndreyBelym and unassigned titerman Jul 5, 2021
@Farfurix
Copy link
Contributor

Our getAttribute's returned value (undefined) is not consistent with Element.getAttribute() (null). We need to fix it in our source code and type definitions.

@Farfurix Farfurix changed the title [docs]: SelectorAPI.getAttribute can return undefined but docs indicate it always returns a string SelectorAPI.getAttribute can return undefined but docs indicate it always returns a string Jul 15, 2021
@Farfurix Farfurix self-assigned this Jul 15, 2021
@Farfurix Farfurix linked a pull request Jul 16, 2021 that will close this issue
2 tasks
miherlosev pushed a commit that referenced this issue Jul 16, 2021
* fix: fixed getAttribute return value (closes #5984)

* test: fixed expected line value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FREQUENCY: level 1 TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants