Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document.webkitFullscreenElement always undefined #2896

Closed
samuelsh opened this issue Jul 17, 2018 · 1 comment
Closed

document.webkitFullscreenElement always undefined #2896

samuelsh opened this issue Jul 17, 2018 · 1 comment

Comments

@samuelsh
Copy link

Following code won't work, webkitFullscreenElement is undefined even if Full Screen mode is set:

isFullScreen: async function (page) {
        const executionContext = await page.mainFrame().executionContext();
        const fullscreenElement =  await executionContext.evaluate(() => {
            return document.webkitFullscreenElement
        });
        console.debug('isFullScreen: ' + fullscreenElement);
        return !!(fullscreenElement && fullscreenElement.nodeName === 'video');
    }
@aslushnikov
Copy link
Contributor

@samuelsh You should use evaluateHandle instead of evaluate.

It's unfortunate that page.evaluate doesn't throw an error in this case; this will be fixed in the next major release: #2079

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants