Skip to content
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

Improve TextContent null element detection #1371

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

inancgumus
Copy link
Member

@inancgumus inancgumus commented Jun 6, 2024

What?

The TextContent methods now return false when the element's text content cannot be grabbed (like a JS document). I've added tests only for ElementHandle as the other types have their TextContent tests.

Why?

Previously, these methods returned an empty string (""). That approach makes it impossible to distinguish between whether the text content is missing or empty.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

#428

@inancgumus inancgumus self-assigned this Jun 6, 2024
@inancgumus inancgumus added enhancement New feature or request playwright Issue relating to Playwright compatibility labels Jun 6, 2024
@inancgumus inancgumus changed the title Improve/text content null detection Improve TextContent null element detection Jun 6, 2024
@inancgumus inancgumus requested a review from ankur22 June 6, 2024 09:49
Copy link
Collaborator

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@inancgumus inancgumus force-pushed the improve/get-attribute-null-detection branch from 359cb96 to a348af1 Compare June 6, 2024 15:20
@inancgumus inancgumus force-pushed the improve/text-content-null-detection branch from 7b14f71 to b987414 Compare June 6, 2024 15:20
Base automatically changed from improve/get-attribute-null-detection to main-async June 6, 2024 15:22
@inancgumus inancgumus force-pushed the improve/text-content-null-detection branch from b987414 to 770f2ae Compare June 6, 2024 15:23
@inancgumus inancgumus merged commit e018aa2 into main-async Jun 6, 2024
13 of 14 checks passed
@inancgumus inancgumus deleted the improve/text-content-null-detection branch June 6, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request playwright Issue relating to Playwright compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants