I am facing an issue with moving large chunk of data from file to TextArea in the app.
Its taking lots of time and inputing data Line by line ...
Please find the code snippet below and suggest if something can be done to make it fast.
This is the code to read file content using streams.
public static String readFileDataAsString(String filePath) {
byte[] buffer = new byte[(int) new File(filePath).length()];
BufferedInputStream f = null;
try {
f = new BufferedInputStream(new FileInputStream(filePath));
f.read(buffer);
} catch (Exception e) {
e.printStackTrace();
}
finally {
//Closing the file.
if (f != null) try { f.close(); } catch (IOException e) {
e.printStackTrace();
}
}
return new String(buffer);
}
Code to send File content to UI Field in Selenium is:
String data;
data = readFileDataAsString(filePath)
we.clear();
we.sendKeys(data);
also, tried selenium.type("locator", data)