New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy paste not working using Robot Class: Ctrl+C; content is not saving into clipboard, but it used to work perfectly fine few days back #5327
Comments
Not related to Selenium. |
May i know which is the right platform? Below statement is the issue, i believe its part of selenium-Robot (import java.awt.*) Error: Exception in thread "main" java.awt.datatransfer.UnsupportedFlavorException: Unicode String |
I mean its copying text and not storing text into clipboard using robot class Key Events, but it used to working fine previously robot.keyPress(KeyEvent.VK_SHIFT); Thread.sleep(2000); String str=(String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); |
If you think there's an issue with selenium, offer a reproducible scenario using only selenium. Otherwise, I'm afraid it's impossible for us to debug. Please raise an issue with the library you are using first. If something "just changed" within the last couple of days, if anything it is probably a driver issue and not a selenium issue. |
Java AWT Robot is a part of Java SDK, it's not a part of Selenium. |
@barancev Could you please help me with exact link where i can raise this issue. I'm not able to find it out. Thanks in Advance !! |
This is a question rather than an issue. Try to post it to https://stackoverflow.com/ |
Meta -
OS: Windows 10
Selenium Version: 3.5.3; WebDriver
Browser: NA; Trying to copy text from outlook/Any file using Robot class and its features; Basically we can open outlook using Sikuli or Winnium; here problem is about Robot class and its features that "Using Robot class i have copied content during run time BCDE and trying to retrieve it from clipboard to print again in console or any other file. But it's fetching old value from the clip board? but it used to work perfectly fine few days back.
Expected Output is: BCDE"
import java.awt.AWTException;
import java.awt.HeadlessException;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.IOException;
import org.sikuli.basics.Settings;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
public class Sikuli_Demo {
public static void main(String[] args) throws InterruptedException, FindFailed, AWTException, HeadlessException, UnsupportedFlavorException, IOException {
}
}
**Console:
**
Basically i got below error first:
Jan 11, 2018 6:15:36 PM java.util.prefs.WindowsPreferences
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[log] CLICK on L(540,1401)@s(0)[0,0 2560x1440]
[log] CLICK on L(58,214)@s(0)[0,0 2560x1440]
[log] TYPE "ABCDE"
[log] TYPE "#LEFT.#LEFT.#LEFT.#LEFT."
Check1
Check2
Exception in thread "main" java.awt.datatransfer.UnsupportedFlavorException: Unicode String
at sun.awt.datatransfer.SunClipboard.getData(Unknown Source)
at Sikuli_Demo.main(Sikuli_Demo.java:63)
But After following below steps error is not coming but clipboard is not saving the copied content during run time: https://stackoverflow.com/questions/8513740/copy-paste-not-working-in-a-signed-applet
On Windows 7, it can be found at C:\Program Files (x86)\Java\jre6\lib\security. Copy this file to your home folder (ex. C:\Users\Kyle). Rename the file to .java.policy (note the period at the beginning). Edit the file in a text editor. Locate this line of text:
Add the following line just below it like so:
// "standard" properies that can be read by anyone
permission java.awt.AWTPermission "accessClipboard";
Save the file. Close any open browsers and ensure that Java is not running before testing.
Console after following above steps:
Jan 11, 2018 5:41:31 PM java.util.prefs.WindowsPreferences
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[log] CLICK on L(540,1401)@s(0)[0,0 2560x1440]
[log] CLICK on L(58,214)@s(0)[0,0 2560x1440]
[log] TYPE "ABCDE"
[log] TYPE "#LEFT.#LEFT.#LEFT.#LEFT."
Check1
Check2
Copied content is :praveenreddygm@gmail.com
[log] TYPE "praveenreddygm@gmail.com "
Expected Output: BCDE
The text was updated successfully, but these errors were encountered: