How to upload file in headless browser using robot class in selenium java as sendkeys() method not working in my case. I am using firefox and selenium web driver java for my script
解决方案
No need to use Robot class for uploading file using selenium java.
Just at first, (1) Upload your files in /tmp folder in case of linux and temp folder in case of windows OS and then, use below code to upload files
String path = FILE_UPLOAD_PATH;
//(Full path with file name from /tmp folder)
driver.findElement(By.id("FILE_INPUT_ID")).sendKeys(path);
and it will upload file.
Note : Please remove file from /tmp folder after uploading, if no need to free memory.