[๐Ÿ› Bug]: `Cannot find name 'browser'.ts(2304)` and `Namespace 'global.WebdriverIO' has no exported member 'Element'.ts(2694)`

See original GitHub issue

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

v14.15.1

Mode

WDIO Testrunner

Which capabilities are you using?

No response

What happened?

I just created a default project with latest everything choosing TypeScript and Cucumber. Tests pass, but when I go to the pageobjects fijes I get the following errors:

Namespace 'global.WebdriverIO' has no exported member 'Element' .ts(2694)
Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.ts(2581)
Cannot find name 'browser'.ts(2304)

What is your expected behavior?

This errors should not be popping.

How to reproduce the bug.

  • Create npm project ( npm init -y )
  • Create wdio project ( npm init wdio )
    • Selected typescript and cucumber
  • Run automatically generated tests -> pass
  • Go to see pageobjects at features/pageobjects
  • See TS errors raise with WebdriverIO.Element and, browser and $ objects:
Namespace 'global.WebdriverIO' has no exported member 'Element' .ts(2694)
Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.ts(2581)
Cannot find name 'browser'.ts(2304)

Relevant log output

Namespace 'global.WebdriverIO' has no exported member 'Element' .ts(2694)
Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.ts(2581)
Cannot find name 'browser'.ts(2304)


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Is there an existing issue for this?

- [X] I have searched the existing issues

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Lucasmiguelmaccommented, Feb 18, 2022

Already fixed it. Apparently the installer sent my tsconfig and my wdio.conf as well inside a /test/ directory. Never happened to me before. Easy fix though.

1reaction
matzetroniccommented, Dec 5, 2022

~same here ๐Ÿ˜ž~ works using Node 16 and the following tsconfig.json setting:

{
  "compilerOptions": {
    "types": ["node", "@wdio/globals/types"],
  }
}

๐Ÿ‘๐Ÿป

Read more comments on GitHub >

github_iconTop Results From Across the Web

webdriverio/webdriverio - Gitter
ts:830:41 - error TS2694: Namespace 'WebDriver' has no exported member 'BaseClient'. 830 interface Browser extends WebDriver.BaseClient { Found 1 error.
Read more >
e2e tsconfig types not found: error TS2304: Cannot find name ...
I'm trying to setup an example angular project using a simple webdrioverio e2e test, but run into some compilation errors for my e2e...
Read more >
TypeScript Setup - WebdriverIO
You can write tests using TypeScript to get auto-completion and type safety. You will need typescript and ts-node installed as devDependencies , via:....
Read more >
webdriverio@8.0.13 - jsDocs.io
A method to create a new session with WebdriverIO. NOTE: If you hit "error TS2694: Namespace 'global.WebdriverIO' has no exported member 'ย ...
Read more >
WebdriverIO 7 Rewritten in Typescript, Released with ... - InfoQ
The browser and mobile automation test framework WebdriverIO recently released a major update. Webdriver IO 7 is now written with TypeScriptย ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found