xebia / Xebium

Xebium provides Selenium (webdriver) bindings for FitNesse, with Selenium-IDE support
http://xebia.github.com/Xebium/
Apache License 2.0
76 stars 62 forks source link

FitNesse/Xebium set proxy on remoteWebdriver session #166

Closed babwade closed 7 years ago

babwade commented 7 years ago

Hi, Do you have an idea to how to set a proxy on remote server? In my case I want to remote BrowserStack devices but I am facing proxy trouble. See my Capability configuration

!define Capability {!-{ "name": "Android Device for BrowserStack", "remote": "https://:@hub-cloud.browserstack.com/wd/hub", "browserName": "chrome", "platform":"ANDROID", "device":"Google Nexus 5",
"browserstack.debug":"true", "acceptSslCerts":"True", proxy:{"proxyType":"MANUAL","httpProxy":":","sslProxy":":"}

}-!}

|script|selenium driver fixture| |start browser|${Capability}| on url ||

Below error log by FitNesse. Thanks for any help

EXCEPTION:java.lang.RuntimeException: Unknown browser type. Should be one of 'firefox', 'iexplore', 'chrome', 'opera', 'opera-mobile-tablet', 'opera-mobile-phone', 'htmlUnit' or 'htmlUnit+js' at com.xebia.incubator.xebium.DefaultWebDriverSupplier.newWebDriver(DefaultWebDriverSupplier.java:115) [xebium-0.13.jar] at com.xebia.incubator.xebium.SeleniumDriverFixture.defaultWebDriverInstance(SeleniumDriverFixture.java:98) [xebium-0.13.jar] at com.xebia.incubator.xebium.SeleniumDriverFixture.startBrowserOnUrl(SeleniumDriverFixture.java:199) [xebium-0.13.jar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_121] at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:81) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:57) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:38) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:72) [fitnesse-standalone.jar] at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:135) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:108) [fitnesse-standalone.jar] at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35) [fitnesse-standalone.jar] at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.serve(SlimServer.java:49) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.handle(SlimService.java:154) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.acceptOne(SlimService.java:162) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.accept(SlimService.java:124) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.main(SlimService.java:56) [fitnesse-standalone.jar] Caused by: java.lang.RuntimeException: Unable to fetch required fields from json string at com.xebia.incubator.xebium.RemoteWebDriverSupplier.(RemoteWebDriverSupplier.java:59) [xebium-0.13.jar] at com.xebia.incubator.xebium.DefaultWebDriverSupplier.newWebDriver(DefaultWebDriverSupplier.java:113) [xebium-0.13.jar] at com.xebia.incubator.xebium.SeleniumDriverFixture.defaultWebDriverInstance(SeleniumDriverFixture.java:98) [xebium-0.13.jar] at com.xebia.incubator.xebium.SeleniumDriverFixture.startBrowserOnUrl(SeleniumDriverFixture.java:199) [xebium-0.13.jar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_121] at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:81) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:57) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:38) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:72) [fitnesse-standalone.jar] at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:135) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:108) [fitnesse-standalone.jar] at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35) [fitnesse-standalone.jar] at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.serve(SlimServer.java:49) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.handle(SlimService.java:154) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.acceptOne(SlimService.java:162) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.accept(SlimService.java:124) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.main(SlimService.java:56) [fitnesse-standalone.jar] Caused by: org.json.JSONException: JSONObject["proxy"] not a string. at org.json.JSONObject.getString(JSONObject.java:658) [fitnesse-standalone.jar] at com.xebia.incubator.xebium.RemoteWebDriverSupplier.jsonObjectToMap(RemoteWebDriverSupplier.java:70) [xebium-0.13.jar] at com.xebia.incubator.xebium.RemoteWebDriverSupplier.(RemoteWebDriverSupplier.java:57) [xebium-0.13.jar] at com.xebia.incubator.xebium.DefaultWebDriverSupplier.newWebDriver(DefaultWebDriverSupplier.java:113) [xebium-0.13.jar] at com.xebia.incubator.xebium.SeleniumDriverFixture.defaultWebDriverInstance(SeleniumDriverFixture.java:98) [xebium-0.13.jar] at com.xebia.incubator.xebium.SeleniumDriverFixture.startBrowserOnUrl(SeleniumDriverFixture.java:199) [xebium-0.13.jar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_121] at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:81) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:57) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:38) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:72) [fitnesse-standalone.jar] at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:135) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:108) [fitnesse-standalone.jar] at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35) [fitnesse-standalone.jar] at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.serve(SlimServer.java:49) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.handle(SlimService.java:154) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.acceptOne(SlimService.java:162) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.accept(SlimService.java:124) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.main(SlimService.java:56) [fitnesse-standalone.jar]

maheshkukrani commented 7 years ago

I think the error is about the JSON format. Can you try first, by removing the proxy part of the Json. I think problem lies in the proxy object of your whole JSON. If step 1 is good then you know the culprit. Try this then as i see already some problem with you proxy object construct. I have only pasted a part , i hope its clear.:-


"acceptSslCerts":"True", "proxy": { "proxyType": "manual", "httpProxy": "", "sslProxy" : "" }

babwade commented 7 years ago

Hi, Thanks for reply. I have solved the problem. This is a selenium deficiency : by default there is no method to set username and password on remote driver using proxy. You can to builld your own client http factory Solution is explained here : http://stackoverflow.com/questions/34846014/using-selenium-remotewebdriver-behind-corporate-proxy

Thanks!