Sikuli file upload even after writing the correct script getting error Any solution

0 votes
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)
Dec 14, 2020 in Selenium by faha
• 380 points
2,524 views

Hello @Faha,

Could you please post your error logs here?

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)"))

Dec 14, 2020 9:51:43 AM 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)

1 answer to this question.

0 votes

Hey, @Faha,

This error message...

JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.

implies that there was a JavaScript error while GeckoDriver initiated/spawned a new Browsing Context i.e. Firefox browsing session.


When Selenium driven GeckoDriver initiates a Firefox browsing session there can be a couple of JavaScript-related WARNINGS and ERRORS as a part of TRACE level logs during initialization. You can safely ignore those initialization errors till GeckoDriver is successfully able to initiate a Firefox Browsing session.

answered Dec 15, 2020 by Gitika
• 65,770 points
@ Gitika

Yeah that's right to ignore but how about uploading file (thru location and file name) C:\\Selenium practice\\drivers\\profile.pic.jpg. Don't know why it's not uploading in the end

Hello, @faha,

To work with Sikuli, need to download “sikuli-setup.jar” and run the same to get the “sikuli-java.jar” then we can use this jar file in our project to work with Sikuli.

And I would suggest you can take help from here regarding what you trying to do https://www.edureka.co/blog/uploading-file-usiing-selenium/

Related Questions In Selenium

0 votes
0 answers

For conditions 2 and 3 getting error Class cast exception. Any solution?

public class ScrollingPage { public static void main(String[] ...READ MORE

Dec 25, 2020 in Selenium by faha
• 380 points
1,250 views
0 votes
1 answer
0 votes
1 answer

Error with Selenium File Upload

In your code, you have used "WebElement" ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,500 points
6,226 views
0 votes
1 answer

How to handle the popup of file upload in Windows OS with WebDriver?

The value of name locator has probably ...READ MORE

answered Apr 25, 2018 in Selenium by king_kenny
• 3,710 points
18,530 views
+4 votes
1 answer
+1 vote
1 answer
0 votes
1 answer

Getting error while running a XML file in TestNG

Hello @Sradha, The synatx of using test is ...READ MORE

answered Dec 26, 2018 in Selenium by Rashmi
16,351 views
0 votes
1 answer

Error showing up, Unable to click the second page and get title. Any Solution?

Hi, @Faha, As you access the URL http://demo.automationtesting.in/Windows.html there ...READ MORE

answered Nov 25, 2020 in Selenium by Gitika
• 65,770 points
4,032 views
0 votes
1 answer

Error as the previous one for sikuli upload

@Faha, This error message... JavaScript error: resource://gre/modules/XULStore.jsm, line 66: ...READ MORE

answered Dec 15, 2020 in Selenium by Gitika
• 65,770 points
1,788 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP