Best approach for global functions in Typescript #12673
Unanswered
unknowntester404
asked this question in
Q&A
Replies: 2 comments 4 replies
-
I suggest you extend the browser object using the addCommand command |
Beta Was this translation helpful? Give feedback.
3 replies
-
Another option would be to use Page Objects which you can import in all files and allow you to manage selectors and elements. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
What will be the best approach to have functions available globally?
Currently, in JS I have global.getElement(selector) { const element = await $(selector)
return element}
but this approach does not work with ts.
What will be the best approach to use getElement function globally in all files from the entire repo something like get myLocator {
const myElement = getElement('#myid#)
}
Thanks
Beta Was this translation helpful? Give feedback.
All reactions