I’ve written a small script to understand how copy and paste on a screen might work.
The script runs successfully with the expected results on a Windows 10 machine, but it does not work on my MacBook air running Mojave 10.14.6. There are no errors detected, but neither the copy or paste work on the Mac. After running the script, when I manually paste the clipboard, it contains whatever it contained before running the script.
On the Mac I’ve tried using both Keys.CONTROL and Keys.COMMAND. (Which is the correct one?)
Any ideas?
import org.openqa.selenium.Keys as Keys
WebUI.doubleClick(findTestObject(‘Page_tC Create/h1_Login’)) //double click text on a label to highlight it
WebUI.sendKeys(null, Keys.chord(Keys.CONTROL, ‘c’))
WebUI.click(findTestObject(‘Page_tC Create/input__username’))
WebUI.sendKeys(findTestObject(‘Page_tC Create/input__username’), Keys.chord(Keys.CONTROL, ‘v’)) //Paste the clipboard into the username text box