I am trying to copy the contents (text) of a JQueryUI tooltip widget. (https://jqueryui.com/resources/demos/tooltip/default.html) via Selenium for Java.
WebElement.GetText() does not work since (i gather) it is not treated as a regular tooltip. Nor have i had any success in retrieving the text via the JQueryUI API e.g. :
So i would like to simulate a copy to clipboard :
tooltip.sendKeys(Keys.CONTROL, "c"); but i need my automation to be cross-platform. In Mac OS it would be cmd+C which isn’t working from what i gather around stackoverflow.
I found this method of copying to clipboard :
StringSelection stringSelection = new StringSelection("test");
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
But this requires me to produce the string myself (the “test” string), whereas i don’t have it yet. i need something to do the actual copying to clipboard. Is there any way to do this at the system level in Java? or alternatively another way to do this ?