twalpole / apparition

Capybara driver for Chrome using CDP
MIT License
363 stars 46 forks source link

Can't read clipboard #90

Open jubishop opened 2 years ago

jubishop commented 2 years ago

I'm trying to read the clipboard, like so:

    page.driver.browser.command(
        'Browser.setPermission',
        permission: { name: 'clipboard-read' },
        setting: 'granted')
    clip_text = page.evaluate_async_script('navigator.clipboard.readText().then(arguments[0])')

but I get told error: DOMException: Read permission denied

it seems like this should be the right code. any ideas?

jubishop commented 2 years ago
    page.driver.browser.command(
        'Browser.grantPermissions',
        permissions: ['clipboardReadWrite'])

also does not seem to work