Skip to content

Need help typing getElements return value in typescript #11989

Discussion options

You must be logged in to vote

@sarahandromeda the return value for await $$(someSelector) should be WebdriverIO.ElementArray and foundElems[0] should resolve to WebdriverIO.Element. If you don't have the WebdriverIO namespace available, I guess the type setup is not correct. It should normally pick it up automatically. Try one of the following:

  • if you rely on globals, make sure to set @wdio/globals/types to the tsconfig.json as you can see in the docs
  • import globals directly via import { $$ } from '@wdio/globals'
  • Try to add /// <reference types="webdriverio"> to the top of the file.

Let me know if these work.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sarahandromeda
Comment options

@sarahandromeda
Comment options

Answer selected by sarahandromeda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants