Exception in thread "main" org.openqa.selenium.UnsupportedCommandException:
Meta -
OS: Windows 7 32 bit Selenium Version: selenium-server-standalone-2.47.1.jar Browser: Chrome / Firefox Browser Version: 49
Expected Behavior -
Running the script in Hub and expecting the script to be execute in node
Actual Behavior -
Getting below exception: Exception in thread "main" org.openqa.selenium.UnsupportedCommandException:
HTTP ERROR: 403
Forbidden for Proxy
RequestURI=/session
Command duration or timeout: 390 milliseconds Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16' System info: host: 'user-PC', ip: '192.168.2.2', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_45' Driver info: org.openqa.selenium.remote.RemoteWebDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242) at org.openqa.selenium.remote.RemoteWebDriver.in command prompt started hub by specifying: java -jar selenium-server-standalone-2.47.1.jar -role hub
D:\UD\jars>java -jar selenium-server-standalone-2.47.1.jar -role hub
16:25:25.386 INFO - Launching Selenium Grid hub
2016-04-08 16:25:27.804:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT
2016-04-08 16:25:27.955:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContext
Handler{/,null}
2016-04-08 16:25:28.014:INFO:osjs.AbstractConnector:Started [email protected].
0.0:4444
16:25:28.016 INFO - Nodes should register to http://192.168.2.2:4444/grid/regist
er/
16:25:28.018 INFO - Selenium Grid hub is up and running
**16:31:12.162 INFO - Registered a node http://192.168.2.2:5557** this one is after registering node
Following is node launch in the same machine:
D:\UD\jars>java -jar selenium-server-standalone-2.47.1.jar -role webdriver -hub
http://192.168.2.2:4444/grid/register/ -port 5557
16:31:09.417 INFO - Launching a Selenium Grid node
16:31:11.693 INFO - Java: Oracle Corporation 25.45-b02
16:31:11.694 INFO - OS: Windows 7 6.1 x86
16:31:11.707 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
16:31:11.841 INFO - Driver class not found: com.opera.core.systems.OperaDriver
16:31:11.842 INFO - Driver provider com.opera.core.systems.OperaDriver is not re
gistered
16:31:12.011 INFO - Selenium Grid node is up and ready to register to the hub
16:31:12.112 INFO - Starting auto registration thread. Will try to register ever
y 5000 ms.
16:31:12.112 INFO - Registering the node to the hub: http://192.168.2.2:4444/gri
d/register
16:31:12.163 INFO - The node is registered to the hub and ready to use
After that executed below code:
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class gridEx
{
static RemoteWebDriver driver;
public static void main(String[] args) throws MalformedURLException
{
DesiredCapabilities caps=new DesiredCapabilities().chrome();
caps.setPlatform(Platform.VISTA);
caps.setBrowserName("chrome");
driver=new RemoteWebDriver(new URL("http://192.168.2.2:5557"),caps);
driver.get("http://www.google.com");
driver.findElementByName("q").sendKeys("Hello world");
driver.quit();
}
}
Getting below exception:
Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: <html>
<head>
<title>Error 403 Forbidden for Proxy</title>
</head>
<body>
<h2>HTTP ERROR: 403</h2><pre>Forbidden for Proxy</pre>
<p>RequestURI=/session</p>
<p><i><small><a href="http://jetty.mortbay.org">Powered by Jetty://</a></small></i></p>
</body>
</html>
Command duration or timeout: 390 milliseconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'user-PC', ip: '192.168.2.2', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
at gridEx.main(gridEx.java:18)
The new remote webdriver url should end with "/wd/hub" also, you're specifying the node port rather than the hub port, but either will technically work (just not what you seem to intend on doing, which is use a grid hub)