Skip to content

[🐛 Bug]: Element#getHTML returns any since v9 #14827

@gavvvr

Description

@gavvvr

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

v9.20.0

Node.js Version

v20.19.1

Mode

Standalone Mode

Which capabilities are you using?

What happened?

TypeScript compiler will produce error for the following code:

const element = $('.class');
const html: string = element.getHTML(); # <--- TS2322

This is broken since v9:

What is your expected behavior?

WebdriverIO.Element.getHTML() should return string

How to reproduce the bug.

https://stackblitz.com/edit/vitejs-vite-aq6xi9tf?file=main.ts&view=editor

Relevant log output

main.ts:2:7 - error TS2322: Type 'Promise<any>' is not assignable to type 'string'.

2 const html: string = element.getHTML();

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions