Closed
Description
What are you trying to achieve?
When using AI to generate Page Objects, it generates a number of them that start with simply locate()
with no parameter passed.
According to the code, this is completely valid:
Locator.build = (locator) => { if (!locator) return new Locator({ xpath: '//*' }); return new Locator(locator, 'css'); };
Typescript is upset there is nothing passed as the type is defined as:
static build(locator: CodeceptJS.LocatorOrString): Locator;
Since the actual function doesn't care about having a 'locator' actually passed, this should be set to optional.
static build(locator?: CodeceptJS.LocatorOrString): Locator;
Details
- CodeceptJS version: 3.6.7
- NodeJS Version:22.2.0
- Operating System: Mac
Workaround
Add a locator parameter to the locate call.
Metadata
Metadata
Assignees
Labels
No labels