1

I am using a Sikuli wrapper for .NET (Sikuli4Net). Using an embedded jetty server, it exposes the core functionality of Sikuli for use within .NET projects. However, in Visual Studio, when I try to run a WebDriver test script in which I included Sikuli4Net commands, as soon as the first Sikuli4Net command executes, the test fails with the following error message:

Test Name:  TheBusinessRulesAndProjectsOptionalActionsTest
Test FullName:  BatteryCorp.Test.UI.IterationChinese.BusinessRulesAndProjectsOptionalActions.TheBusinessRulesAndProjectsOptionalActionsTest
Test Source:    c:\BCApps\Main\Src\AutomatedTesting_Solution\BatteryCorp.Test.UI\IterationChinese\BusinessRulesAndProjectsOptionalActions.cs : line 51
Test Outcome:   Failed
Test Duration:  0:00:28.397

Result Message: 
System.Net.WebException : Unable to connect to the remote server
  ----> System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it 127.0.0.1:8080
Result StackTrace:  
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at Sikuli4Net.sikuli_REST.Screen.MakeRequest(String requestURLExtension, String jsonObject)
at Sikuli4Net.sikuli_REST.Screen.Find(Pattern pattern, Boolean highlight)
at Something.Test.UI.Something2.Something3.TheSomethingTest() in c:\BCApps\Something.cs:line 79
--SocketException
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
Result StandardOutput:  --Log for this test run can be found at: C:\BCApps\Something\Sikuli4Net.Client.Logs\log.8182014449 PM.txt--
:::Making Request to Service: http://localhost:8080/sikuli/api/find POST: {"jPattern":{"imagePath":"C:/BCApps/Something/PatternImages/CDrive.png","offset_x":0,"offset_y":0,"similar":0.7},"highlight":false}:::
  • silly question, but just to be sure did you start your jetty service? – mutt Aug 19 '14 at 13:01
1

Try following code to start server:

APILauncher launcher = new APILauncher(true);
launcher.Start();
0

Try to open this address in browser first to check server is up. Also another Web App can be launched or hosted on this address and port.

Check Firewall settings, try to disable it and check the results.

0
  1. check if the jetty servlet will start in the windows console.
  2. if not, download this file sikulirestapi-1.0.jar, copy and paste in directory bin project c#.
  3. disable firewall.

This worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.