QA-Selenium / Sample

1 stars 0 forks source link

I am getting error "org.openqa.selenium.WebDriverException: Unable to parse remote response: " and I don't know how to solve this. So guys could you please help me #1

Open QA-Selenium opened 5 years ago

QA-Selenium commented 5 years ago

Hello everyone,

I am learning Selenium. So I was trying to run parallel execution via Grid. And I got below error. I have mentioned the complete error detail below. Please help me to solve it.

org.openqa.selenium.WebDriverException: Unable to parse remote response: Grid Console

DefaultRemoteProxy (version : 3.141.59)

id : http://192.168.1.100:5555, OS : WIN10

WebDriver

v:

v:

v:

browserTimeout: 0

debug: false

host: 192.168.1.100

port: 5555

role: node

timeout: 1800

cleanUpCycle: 5000

maxSession: 4

capabilities: Capabilities {browserName: firefox, maxInstances: 4, platform: WIN10, platformName: WIN10, seleniumProtocol: WebDriver, server:CONFIG_UUID: 3e72bd4c-f8e2-431b-b3fc-bd1...}

capabilities: Capabilities {browserName: iexplore, platform: WIN10, platformName: WIN10, seleniumProtocol: WebDriver, server:CONFIG_UUID: aa4d88d7-f0aa-4e1e-8b4f-9ee...}

capabilities: Capabilities {browserName: chrome, maxInstances: 3, platform: WIN10, platformName: WIN10, seleniumProtocol: WebDriver, server:CONFIG_UUID: 0d6870ce-56b2-409e-8baf-af4...}

downPollingLimit: 2

hub: http://localhost:4444/grid/register

id: http://192.168.1.100:5555

nodePolling: 5000

nodeStatusCheckTimeout: 5000

proxy: org.openqa.grid.selenium.proxy.DefaultRemoteProxy

register: true

registerCycle: 5000

remoteHost: http://192.168.1.100:5555

unregisterIfStillDownAfter: 60000

    Config for the hub :
    browserTimeout : 0
    debug : false
    host : 192.168.1.100
    port : 4444
    role : hub
    timeout : 1800
    cleanUpCycle : 5000
    capabilityMatcher : org.openqa.grid.internal.utils.DefaultCapabilityMatcher
    newSessionWaitTimeout : -1
    throwOnCapabilityNotPresent : true
    registry : org.openqa.grid.internal.DefaultGridRegistry
    View Verbose

    The final configuration comes from:
    the default :
    browserTimeout : 0
    debug : false
    host : 0.0.0.0
    port : 4444
    role : hub
    timeout : 1800
    cleanUpCycle : 5000
    capabilityMatcher : org.openqa.grid.internal.utils.DefaultCapabilityMatcher
    newSessionWaitTimeout : -1
    throwOnCapabilityNotPresent : true
    registry : org.openqa.grid.internal.DefaultGridRegistry
    updated with command line options:
    -role hub
    View Config
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:115) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144) at MyTryPackage.GridRunningTestWithGrid.doLogin(GridRunningTestWithGrid.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86) at org.testng.internal.Invoker.invokeMethod(Invoker.java:645) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:822) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1130) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) at org.testng.TestRunner.privateRun(TestRunner.java:782) at org.testng.TestRunner.run(TestRunner.java:632) at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at org.testng.SuiteRunner.run(SuiteRunner.java:268) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244) at org.testng.TestNG.runSuitesLocally(TestNG.java:1169) at org.testng.TestNG.run(TestNG.java:1064) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177) Caused by: org.openqa.selenium.json.JsonException: Unable to determine type from: <. Last 1 characters read: < Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'LAPTOP-22R5VRV9', ip: '192.168.1.100', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_211' Driver info: driver.version: RemoteWebDriver at org.openqa.selenium.json.JsonInput.peek(JsonInput.java:122) at org.openqa.selenium.json.JsonTypeCoercer.lambda$null$6(JsonTypeCoercer.java:140) at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:126) at org.openqa.selenium.json.Json.toType(Json.java:69) at org.openqa.selenium.json.Json.toType(Json.java:55) at org.openqa.selenium.json.Json.toType(Json.java:50) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:112) ... 31 more

    My java code
    package MyTryPackage;

    import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit;

    import org.openqa.selenium.By;

    import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.Test; import org.testng.annotations.Parameters;

    public class GridRunningTestWithGrid {

    public static WebDriver driver =null;
    public static DesiredCapabilities cap = new DesiredCapabilities();
    
    @Parameters({"browser"})
    @Test
    public void doLogin(String browser) throws MalformedURLException
    {  if(browser.equals("Chrome"))  
       {
          cap.setBrowserName("Chrome");
          cap.setPlatform(Platform.ANY);
    
          ChromeOptions option = new ChromeOptions();
          option.merge(cap);
       } else if(browser.equals("Firefox"))
         {  cap.setBrowserName("Firefox");
             cap.setPlatform(Platform.ANY);        
         }
    
          driver = new RemoteWebDriver(new URL("http://localhost:4444/grid/console"), cap);     
    
          driver.get("https://accounts.google.com/signin/v2/identifier?service=mail&flowName=GlifWebSignIn&flowEntry=ServiceLogin");
          driver.manage().window().maximize();
          driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    
          driver.findElement(By.xpath("//input[@type='email']")).sendKeys("tikarihamanisha123@gmail.com");
          driver.findElement(By.xpath("//span[@class='RveJvd snByac']")).click();
    
          WebDriverWait wait = new WebDriverWait(driver, 15);
          wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@type='password']"))).sendKeys("tropical11617");         
    
          driver.quit();
    }

    }

    testng.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

    I am configuring hub and node in my laptop only , which has Windows 10 O.S.

    I ran below command in command prompt to configure hub C:\Selenium Testing\Softwares>java -jar selenium-server-standalone-3.141.59.jar -role hub

    After hitting enter , it produced below lines 20:23:32.267 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358 20:23:32.355 INFO [GridLauncherV3.lambda$buildLaunchers$5] - Launching Selenium Grid hub on port 4444 2019-09-10 20:23:32.784:INFO::main: Logging initialized @846ms to org.seleniumhq.jetty9.util.log.StdErrLog 20:23:33.155 INFO [Hub.start] - Selenium Grid hub is up and running 20:23:33.157 INFO [Hub.start] - Nodes should register to http://192.168.1.100:4444/grid/register/ 20:23:33.157 INFO [Hub.start] - Clients should connect to http://192.168.1.100:4444/wd/hub 20:35:00.172 WARN [BaseRemoteProxy.] - Max instance not specified. Using default = 1 instance 20:35:00.192 INFO [DefaultGridRegistry.add] - Registered a node http://192.185.1.100:5555

    I ran below command in command prompt to configure node C:\Selenium Testing\Softwares>Java -Dwebdriver.chrome.driver=chromedriver.exe -Dwebdriver.gecko.driver=geckodriver.exe -Dwebdriver.ie.driver=IEDriverServer.exe -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://localhost:4444/grid/register -port 5555 -browser browserName=firefox,maxInstances=4 -browser browserName=iexplore -browser browserName=chrome,maxInstances=3 -maxSession 4

    After hitting enter , it produced below lines 20:34:58.291 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358 20:34:58.397 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 5555 2019-09-10 20:34:58.787:INFO::main: Logging initialized @732ms to org.seleniumhq.jetty9.util.log.StdErrLog 20:34:59.018 INFO [WebDriverServlet.] - Initialising WebDriverServlet 20:34:59.096 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555 20:34:59.096 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub 20:34:59.239 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms. 20:34:59.776 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://localhost:4444/grid/register 20:35:00.197 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use

    Please let me know, If I am missing any detail. I will provide that too.

    QA-Selenium commented 5 years ago

    Please go thru the document "Error in Detail.txt" , if error detail is not clear in my previous post. Error in Detail.txt

    Also please find testng.xml file in attachment testng.xml.txt