mport org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
public class FileUpload2 {
public static void main(String[] args) throws FindFailed {
System.setProperty("webdriver.gecko.driver","C:\\Drivers\\geckodriver-v0.28.0-win64\\geckodriver.exe");
WebDriver driver =new FirefoxDriver();
driver.get("https://www.file.io");
driver.manage().window().maximize();
driver.switchTo().frame(0);
WebElement choosefile=driver.findElement(By.id("RESULT_FileUpload-10"));
JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript("arguments[0].click();",choosefile);
//sikuli
Pattern fileInputTextBox=new Pattern("C:\\SeleniumPractice\\Sikulifiles\\filetxtbox.png");
Pattern openButton=new Pattern("C:\\SeleniumPractice\\Sikulifiles\\openbtn.png");
Screen s=new Screen();
s.wait(fileInputTextBox,3);
s.type(fileInputTextBox,"C:\\SeleniumPractice\\Sikulifiles\\apple.jpg");
s.click(openButton);
-----------------Console window----------------------
1607910284245 geckodriver INFO Listening on 127.0.0.1:33197 1607910284942 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\mailf\\AppData\\Local\\Temp\\rust_mozprofileu2qnb9" Can't find symbol 'eglSwapBuffersWithDamageEXT'. Can't find symbol 'eglSetDamageRegionKHR'. JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. console.warn: SearchSettings: "get: No settings file exists, new profile?" (new Error("", "(unknown module)")) 1607910287477 Marionette INFO Listening on port 59311 1607910287578 Marionette WARN TLS certificate errors will be ignored for this session Dec 13, 2020 7:44:47 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C Exception in thread "main" FindFailed: C:/SeleniumPractice/Sikulifiles/filetxtbox.png: (979x38) in S(0)[0,0 1504x1003] E:Y, T:3.0 Line 2277, in file Region.java at org.sikuli.script.Region.wait(Region.java:2277) at day20.FileUpload.main(FileUpload.java:56)