Mouse hover in the page now working

@ankur I want to move the mouse cursor to disappear the pop up menu list to interact with the elements inside the iframe.

async clickLoginBtn() {
        await this.loginBtn.waitFor();
        console.log('Login button found');

        await Promise.all([
            this.page.waitForNavigation({ waitUntil: 'networkidle', timeout: 10000 }),
            this.loginBtn.click()
        ]);

        await this.tools.click();
        await Promise.all([
            this.page.waitForNavigation({ waitUntil: 'networkidle', timeout: 10000 }),
            this.configuration.click()
        ]);

        // Get the dimensions of the viewport
        const viewportSize = await page.viewportSize();

        // Move the mouse to the center of the screen
        await page.mouse.move(viewportSize.width / 2, viewportSize.height / 2);

        // Perform a hover action (simulated by moving the mouse slightly)
        await page.mouse.move(viewportSize.width / 2 + 1, viewportSize.height / 2 + 1);

        // Optional: Click after hovering
        await page.mouse.click(viewportSize.width / 2 + 1, viewportSize.height / 2 + 1);

        // Locate the iframe
        const iframeElement = await page.$('#admin_frame');

        // Get the Frame object for the iframe
        const frame = await iframeElement.contentFrame();

        // Now you can interact with elements inside the iframe
        const elementInsideIframe = await frame.$('#mat-input-0');
        await elementInsideIframe.fill('test');
    }

Hi, @inancgumus do you have any idea to solve this? Thank you.

Hi @carlo,

Can you describe the exact problem? If I understand you correctly, have you tried clicking outside of the menu to make it disappear? There can also be an issue on the underlying website; did you check it?

Thanks

Hi, @inancgumus

Yes, I want to click or hover outside the page to disappear the menu list item showing to interact the [Search] field. But hovering and clicking outside the page did not works.

I’d suggest watching what happens using Chromium DevTools inspector. There might be other elements that may be preventing the script from clicking outside.