This thread is trying to answer question "How can I use the Page Object Model with an Electron application script?"
const callPage = new CallPage(mapPage) await callPage.title()
Assuming CallPage has the page objects related to first script you have, I have written above. If mapPage, then alter it accordingly.
I believe you are not calling the instance of page objects and directly injecting mapPage to unknown.
@sabu9 sorry for confusion. attaching script file with error and page model screenshot. you can see with first page hovering error. it is not referring my existing page with electron application. it is going with default page. electron application as we know this is for desktop applications.
Dont use it in beforeEach as you already have page instance. You need firstwindow instance. So
calledPage = await electronApp.firstWindow() return calledPage
test 'Create Event from Commandline @mapview', async ()-> const callPage = new CallPage(calledPage)
// use callPage below instead of mapPage - havent edited below console.log(await mapPage.title)); await mappage.fill('input [name="username"]', 'testinguser4'); await mapPage.press('input [name="username"]', 'Tab'); await mapPage.fill('input[name="password"]', 'password'); mapPage.click('text=Log In'); await mapPage.close;
// for each test say if you are going to have multiple windows in electrin app whenever you click on buttons in it, then everytime you need to make the instance like above and pass the respective page instance.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].