Is there a way to access elements defined in one page object file from another page object file?
Example: If we need to access '@usernameInput' from LoginPage.ts file, do we need to duplicate it from HomePage.ts ? Is there any other way?
HomePage.ts
const page: PageObject = {
url: ...,
commands: [
enterUsername: (query: string) => {
return this
.waitForElementVisible('@usernameInput')
}],
elements: {
usernameInput: {
locateStrategy: 'xpath',
selector: '//input[@name="Username"]',
}
};
LoginPage.js
const page: PageObject = {
url: ...,
commands: [
enterUsername: (query: string) => {
return this
.waitForElementVisible('@usernameInput')
}],
elements: {}
};