sterodium / selenium-grid-extensions

Set of Selenium Grid extensions for a better UI tests.
Apache License 2.0
46 stars 23 forks source link

Unable to upload resource for remote Sikuli test #36

Closed bradmunz79 closed 9 years ago

bradmunz79 commented 9 years ago

Hi there,

I've been following your instructions for remote Sikuli testing but get a HTTP 403 error from the Selenium hub when trying to upload a resource bundle (the bundle is in the classpath). Here is the exception from selenium:

io.sterodium.extensions.client.upload.ResourceUploadException: Resource upload returned status 403 with message:

Error 403 Forbidden for Proxy

HTTP ERROR: 403

Forbidden for Proxy

RequestURI=/extra/FileUploadServlet

Powered by Jetty://

    at io.sterodium.extensions.client.upload.ResourceUploadRequest.upload(ResourceUploadRequest.java:62)
    at io.sterodium.extensions.client.FileExtensionClient.upload(FileExtensionClient.java:45)
    at io.sterodium.extensions.client.SikuliExtensionClient.uploadResourceBundle(SikuliExtensionClient.java:55)

The actually hub logging shows the following:

08:13:14.141 INFO - Forwarding request with path: /session/3404d4fe-c9c8-4c6e-85 3b-da3a3412e598/FileUploadServlet 08:13:14.141 INFO - Retrieving remote host for session: 3404d4fe-c9c8-4c6e-853b- da3a3412e598 08:13:14.141 INFO - Remote host retrieved: 192.168.133.129:5555 08:13:14.144 INFO - Creating POST request to forward 08:13:14.144 INFO - Trimming session id from path, new path: http://192.168.133. 129:5555/extra/FileUploadServlet 08:13:14.150 INFO - Response from extension returned 403 status code 08:13:14.150 INFO - Response from extension returned text/html content type 08:13:14.150 INFO - Response from extension has 1256 content length 08:13:14.150 INFO - Copying body content to original servlet response

I'm using the following versions: sikuli-extension-client: 0.5 selenium-server-standalone: 2.48.2 extension-proxy: 0.5 all-node-extensions:0.5

Any assistance will be greatly appreciated.

clay227 commented 9 years ago

Hi bradmunz79, i saw somthing like this in my environment and was able to fix it. i believe your selenium srever node is not really loading with the sikuli serverlets. (allthough the hub seems fine). what worked for me was to start the server with the -serevlet option like so:

–servlets "io.sterodium.extensions.node.SikuliExtensionServlet,io.sterodium.extensions.node.upload.FileUploadServlet,io.sterodium.extensions.node.download.FileDownloadServlet"

you should see your selenium server logging it start with the /extra/FileUploadServlet. if you don't see that you started your server with missing parameters.

clay227 commented 9 years ago

look for the message "started extra node servlet visible at : http://xxx:5555/extra/FileDownloadServlet/*" at your sleneium node server.

bradmunz79 commented 9 years ago

Thanks. Don't see that in the node log, so I probably need to concentrate there. I'll attach my node.bat and the node-conf.json it's using (which seems to have the correct config you mentioned. Also, here is my node startup logging:

11:15:44.471 INFO - Launching a Selenium Grid node 11:15:45.345 INFO - Java: Oracle Corporation 25.65-b01 11:15:45.345 INFO - OS: Windows 8.1 6.3 x86 11:15:45.345 INFO - v2.48.0, with Core v2.48.0. Built from revision 41bccdd 11:15:45.407 INFO - Driver class not found: com.opera.core.systems.OperaDriver 11:15:45.407 INFO - Driver provider com.opera.core.systems.OperaDriver is not re gistered 11:15:45.533 INFO - Selenium Grid node is up and ready to register to the hub 11:15:45.580 INFO - Starting auto registration thread. Will try to register ever y 5000 ms. 11:15:45.580 INFO - Registering the node to the hub: http://bradleympc:4441/grid /register 11:15:45.611 INFO - The node is registered to the hub and ready to use

This is my node.bat:

java -Dwebdriver.chrome.driver=c:\seleniumdrivers\chromedriver.exe -Dwebdriver.ie.driver=c:\seleniumdrivers\IEDriverServer.exe -cp "selenium-server-standalone-2.48.2.jar;all-node-extensions-0.5.jar" org.openqa.grid.selenium.GridLauncher -role node -nodeConfig node-conf.json

Here is my json config: { "capabilities": [ { "extension.sikuliCapability": true }, { "browserName": "firefox", "maxInstances": 5, "seleniumProtocol": "WebDriver" }, { "browserName": "chrome", "maxInstances": 5, "seleniumProtocol": "WebDriver" }, { "browserName": "internet explorer", "maxInstances": 5, "seleniumProtocol": "WebDriver" } ], "configuration": { "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "hubPort": 4441, "hubHost": "bradleympc" }, "servlets": "io.sterodium.extensions.node.SikuliExtensionServlet,io.sterodium.extensions.node.upload.FileUploadServlet,io.sterodium.extensions.node.download.FileDownloadServlet" }

clay227 commented 9 years ago

try adding this to your batch after the -role node part : -servlets io.sterodium.extensions.node.SikuliExtensionServlet,io.sterodium.extensions.node.upload.FileUploadServlet,io.sterodium.extensions.node.download.Fil eDownloadServlet

echoAlexey commented 9 years ago

Hi, it seems that "servlets" section is not properly defined.

Try include servlets property inside "configuration" object.

"configuration": {
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "hubPort": 4441,
    "hubHost": "bradleympc"
    "register": true,
    "registerCycle": 5000,
   "servlets": "io.sterodium.extensions.node.SikuliExtensionServlet,io.sterodium.extensions.node.upload.FileUploadServlet,io.sterodium.extensions.node.download.FileDownloadServlet"
  }

I've updated documentation to include this.

bradmunz79 commented 9 years ago

Awesome!. That did it. Thanks!