Created
February 14, 2022 12:25
-
-
Save kaisumi/933c5dd1b4486628d24109020cd808ca to your computer and use it in GitHub Desktop.
Clipboard reading in Capybara
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdp_params = { | |
origin: page.server_url, | |
permission: { name: 'clipboard-read' }, | |
setting: 'granted' | |
} | |
page.driver.browser.execute_cdp('Browser.setPermission', **cdp_params) | |
clip_text = page.evaluate_async_script('navigator.clipboard.readText().then(arguments[0])') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you need clipboard write, add this to your rails helper: