-
-
Save ziraqyoung/87e80a5b203a7929b2c961ab2f74d39d to your computer and use it in GitHub Desktop.
Clipboard reading in Capybara
This file contains 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
it "should read clipboard text" do | |
page.driver.browser.execute_cdp( | |
"Browser.setPermission", | |
{ | |
origin: page.server_url, | |
permission: { name: "clipboard-read" }, | |
setting: "granted", | |
}) | |
clip_text = page.evaluate_async_script("navigator.clipboard.readText().then(arguments[0])") | |
expect(clip_text).to eq("copied text") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment