Sikuli using remotewebdriver

Asked by subhabrata pal

Hi,

Is there any way to integrate Sikuli with Selenium-remotewebdriver?

got the following error:

FindFailed: can not find imgs/Advancedsear.png
Line ?, in File ?
 at org.sikuli.script.Region.handleFindFailed(Region.java:349)
 at org.sikuli.script.Region.wait(Region.java:420)
 at org.sikuli.script.Region.find(Region.java:308)
 at org.sikuli.script.Region.getLocationFromPSRML(Region.java:856)
 at org.sikuli.script.Region.click(Region.java:488)
 at org.sikuli.script.Region.type(Region.java:586)
 at Code.selwebdriver.webdrivertest(selwebdriver.java:64)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:81)
 at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)
 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)
 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
 at org.testng.TestRunner.runWorkers(TestRunner.java:1131)
 at org.testng.TestRunner.privateRun(TestRunner.java:752)
 at org.testng.TestRunner.run(TestRunner.java:603)
 at org.testng.SuiteRunner.runTest(SuiteRunner.java:329)
 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:324)
 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:286)
 at org.testng.SuiteRunner.run(SuiteRunner.java:235)
 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1049)
 at org.testng.TestNG.runSuitesLocally(TestNG.java:974)
 at org.testng.TestNG.run(TestNG.java:905)
 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)
 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

It seems you are using relative image filenames: imgs/Advancedsear.png

So are you sure in your environment this directory imgs can be found based on your specification and the current working directory in the moment the Sikuli feature (a type() in this case) is fired from inside webdriver code?

Revision history for this message
subhabrata pal (subhabratapal12) said :
#2

Hi,

"It seems you are using relative image filenames: imgs/Advancedsear.png"
Thats correct.

"So are you sure in your environment this directory imgs can be found based on your specification and the current working directory in the moment the Sikuli feature (a type() in this case) is fired from inside webdriver code?"

I am not sure; I have placed the imgae file in the same location in the remote system as in the caller system. I have used also the absolute path(C:\ECPROJECT\RPM\imgs\Advancedsear.png) - but same result. I may be wrong. I am not sure how to give the path for remote system.

Following is the code:
public class selwebdriver {

@Test
public void webdrivertest() throws Exception {
DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
WebDriver driver = new RemoteWebDriver(new URL("http://10.99.74.56:5555/wd/hub"), capability);
String baseUrl = "www.gmail.com";
Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl);
System.out.println("here");
selenium.open("http://www.google.com");
Screen sikuli = new Screen();

try{
Thread.sleep(5000);
sikuli.type("imgs/Advancedsear.png", "Cheese", 0);
}catch(FindFailed e){
e.printStackTrace();
}
driver.quit();
}

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

Since you are using RemoteWbDriver, I guess, you are using 2 separate machines:
-1- the client machine, where the tests are run
-2- the Selenium server machine, where the target browser runs

Sikuli looks on the screen of machine -1-, since this is where it is running.

Other way round: The Sikuli features have to be used on the machine, where the screen contents are visible.

... and using WebDriver, in some cases you do not see anything, since some things are handled behind the curtain.

Revision history for this message
subhabrata pal (subhabratapal12) said :
#4

Thanks RaiMan, that solved my question.