PlayWright: Page.title() returning empty value. Trying to add automation in electron-vue project

3.3k Views Asked by At

For automated testing, I'm attempting to incorporate Playwright into my electron-vue project. I run the test, and Page.title() returns "". Here is the code:

test("renders the screen splash", async () => {
  let page: Page;
  page = await electronApp.firstWindow();
  console.log("Title: ", await page.title());
  const title = await page.title()
  expect(title).toBe('Splash')
});
1

There are 1 best solutions below

1
On BEST ANSWER

Could you try if it helps?

    test("renders the screen splash", async () => {
      let page: Page;
      page = await electronApp.firstWindow();
      // add the following line
      await page.waitForLoadState();
      console.log("Title: ", await page.title());
      const title = await page.title()
      expect(title).toBe('Splash')
    });