question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to parse remote response: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

See original GitHub issue

Description

Im trying to perform parallel test using selenium grid but im encountring this issue when im running the test
Unable to parse remote response: <html>

<head> Cannot extract a capabilities from the request: { "desiredCapabilities"

Environment

OS macOs Testng version 6.14.3 java client 7.0.0 selenium-server-standalone-3.13.0 and 3.141.59 same result Appium version 1.12.1

Details

` org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: Unable to parse remote response: <html>

<head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 500 Server Error</title> </head> <body>

HTTP ERROR 500

Problem accessing /wd/hub/session. Reason:

    Server Error

Caused by:

java.io.IOException: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
  "desiredCapabilities": {
    "appPackage": "com.sasd",
    "clearSystemFiles": true,
    "uiautomator2ServerInstallTimeout": "6000",
    "unlockKey": "pass",
    "deviceId": "192.168.1.4:5555",
    "deviceName": "SM_N950F",
    "appActivity": "cosdy",
    "platformVersion": "9",
    "automationName": "uiautomator2",
    "unlockType": "password",
    "autoGrantPermissions": "true",
    "platformName": "Android",
    "systemPort": "8230"
  },
  "capabilities": {
    "firstMatch": [
      {
        "appium:appActivity": "comdfstivity",
        "appium:appPackage": "comsdfonary",
        "appium:autoGrantPermissions": "true",
        "appium:automationName": "uiautomator2",
        "appium:clearSystemFiles": true,
        "deviceId": "192.168.1.4:5555",
        "appium:deviceName": "SM_N950F",
        "platformName": "android",
        "appium:platformVersion": "9",
        "appium:systemPort": "8230",
        "uiautomator2ServerInstallTimeout": "6000",
        "unlockKey": "pass",
        "unlockType": "password"
      }
    ]
  }
}
	at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:137)
	at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860)
	at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
	at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
	at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
	at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
	at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
	at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.seleniumhq.jetty9.server.Server.handle(Server.java:530)
	at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347)
	at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256)
	at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
	at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102)
	at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
	at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
	at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
	at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
	at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
	at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
  "desiredCapabilities": {
    "appPackage": "sdsd",
    "clearSystemFiles": true,
    "uiautomator2ServerInstallTimeout": "6000",
    "unlockKey": "pass",
    "deviceId": "192.168.1.4:5555",
    "deviceName": "SM_N950F",
    "appActivity": "cdsfsdfctivity",
    "platformVersion": "9",
    "automationName": "uiautomator2",
    "unlockType": "password",
    "autoGrantPermissions": "true",
    "platformName": "Android",
    "systemPort": "8230"
  },
  "capabilities": {
    "firstMatch": [
      {
        "appium:appActivity": "sd",
        "appium:appPackage": "csds",
        "appium:autoGrantPermissions": "true",
        "appium:automationName": "uiautomator2",
        "appium:clearSystemFiles": true,
        "deviceId": "192.168.1.4:5555",
        "appium:deviceName": "SM_N950F",
        "platformName": "android",
        "appium:platformVersion": "9",
        "appium:systemPort": "8230",
        "uiautomator2ServerInstallTimeout": "6000",
        "unlockKey": "pass",
        "unlockType": "password"
      }
    ]
  }
}
	at org.openqa.grid.web.servlet.handler.WebDriverRequest.extractDesiredCapability(WebDriverRequest.java:76)
	at org.openqa.grid.web.servlet.handler.SeleniumBasedRequest.<init>(SeleniumBasedRequest.java:102)
	at org.openqa.grid.web.servlet.handler.WebDriverRequest.<init>(WebDriverRequest.java:36)
	at org.openqa.grid.web.servlet.handler.WebDriverRequestFactory.createFromRequest(WebDriverRequestFactory.java:30)
	at org.openqa.grid.web.servlet.handler.SeleniumBasedRequest.createFromRequest(SeleniumBasedRequest.java:73)
	at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:84)
	... 29 more
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [deviceId, uiautomator2ServerInstallTimeout, unlockKey, unlockType]
	at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$6(NewSessionPayload.java:211)
	at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:372)
	at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:373)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:373)
	at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
	at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:215)
	at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:163)
	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:118)
	at org.openqa.grid.web.servlet.handler.WebDriverRequest.extractDesiredCapability(WebDriverRequest.java:66)
	... 34 more

Caused by:

org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
  "desiredCapabilities": {
    "appPackage": "comsdfsfionary",
    "clearSystemFiles": true,
    "uiautomator2ServerInstallTimeout": "6000",
    "unlockKey": "pass",
    "deviceId": "192.168.1.4:5555",
    "deviceName": "SM_N950F",
    "appActivity": "codsfsfdnActivity",
    "platformVersion": "9",
    "automationName": "uiautomator2",
    "unlockType": "password",
    "autoGrantPermissions": "true",
    "platformName": "Android",
    "systemPort": "8230"
  },
  "capabilities": {
    "firstMatch": [
      {
        "appium:appActivity": "sdsf",
        "appium:appPackage": "sfd",
        "appium:autoGrantPermissions": "true",
        "appium:automationName": "uiautomator2",
        "appium:clearSystemFiles": true,
        "deviceId": "192.168.1.4:5555",
        "appium:deviceName": "SM_N950F",
        "platformName": "android",
        "appium:platformVersion": "9",
        "appium:systemPort": "8230",
        "uiautomator2ServerInstallTimeout": "6000",
        "unlockKey": "pass",
        "unlockType": "password"
      }
    ]
  }
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [deviceId, uiautomator2ServerInstallTimeout, unlockKey, unlockType]
	at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$6(NewSessionPayload.java:211)
	at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:372)
	at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:373)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:373)
org.openqa.grid.web.servlet.handler.WebDriverRequest.extractDesiredCapability(WebDriverRequest.java:66)
"http://eclipse.org/jetty">Powered by Jetty:// 9.4.7.v20170914

TestNg xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default Suite" thread-count="5" parallel="tests" verbose="2"> <test name="Note8"> <parameter name="deviceName" value="SM_N950F"/> <parameter name="udid" value="988a1641434e36333130"/> <parameter name="deviceId" value="192.168.1.4:5555"/> <parameter name="platformVersion" value="9"/> <parameter name="URL_" value="0.0.0.0"/> <parameter name="Sport" value="5000"/> <parameter name="bootStrap" value="4725"/> <parameter name="sysPort" value="8230"/> <parameter name="wdaPort" value="8230"/> <parameter name="path" value="/users/amrka/desktop/selenium/note8.json"/>
<classes>
    <class name="Tests.LandingPageTest"/>
</classes>

</test>

<test name="Note5">
    <parameter name="deviceName" value="SM_N9208"/>
    <parameter name="udid" value="0715f75124ea0934"/>
    <parameter name="deviceId" value="192.168.1.9:5556"/>
    <parameter name="platformVersion" value="7.0"/>
    <parameter name="URL_" value="0.0.0.0"/>
    <parameter name="Sport" value="5001"/>
    <parameter name="bootStrap" value="4726"/>
    <parameter name="sysPort" value="8240"/>
    <parameter name="wdaPort" value="8240"/>
    <parameter name="path" value="/users/amrka/desktop/selenium/note5.json"/>

    <classes>
        <class name="Tests.LandingPageTest"/>
    </classes>
</test> <!-- DemoProject -->

</suite>


##BaseSetup class `package Configuration;

import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Parameters;

import java.io.File; import java.net.MalformedURLException; import java.net.URL;

import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.remote.AndroidMobileCapabilityType; import io.appium.java_client.remote.MobileCapabilityType; import io.appium.java_client.service.local.AppiumDriverLocalService; import io.appium.java_client.service.local.AppiumServiceBuilder; import io.appium.java_client.service.local.flags.ServerArgument;

public class BaseSetup {

protected static AndroidDriver<MobileElement> driver = null;
protected AppiumDriverLocalService service;
public WebDriverWait wait;
private ThreadLocalDriver threadLocalDriver = new ThreadLocalDriver();

@Parameters({“deviceName”,“platformVersion”,“udid”,“URL_”,“Sport”,“deviceId”,“sysPort”,“bootStrap”,“wdaPort”,“path”}) @BeforeMethod(alwaysRun = true) public void setUp (String deviceName, String platformVersion, String udid, String URL_, String Sport, String deviceId, String sysPort, String bootStrap, String wdaPort, String path) throws MalformedURLException { System.out.println(“Driver Is Initiated”);

    DesiredCapabilities dc = new DesiredCapabilities();

    // mobile setup
    dc.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
    dc.setCapability("deviceId", deviceId);
    dc.setCapability("uiautomator2ServerInstallTimeout", "6000");

// dc.setCapability(MobileCapabilityType.UDID,udid_); dc.setCapability(MobileCapabilityType.PLATFORM_NAME, “Android”); dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion); dc.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, sysPort); dc.setCapability(“unlockType”, “password”); dc.setCapability(“unlockKey”, “pass”); dc.setCapability(“automationName”, “uiautomator2”);

    //application setup
    dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "sdfd");
    dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "dfd");
    dc.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,"true");
    dc.setCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES, true);

    //driver configuration
int port = Integer.parseInt(Sport);

 service = AppiumDriverLocalService
        .buildService(new AppiumServiceBuilder()
                .usingDriverExecutable(new File("/usr/local/bin/node"))
                .withAppiumJS(new File("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js"))
                .withArgument(Arg.ADDRESS,URL_)
                        .withArgument(Arg.BootstrapPort,bootStrap)
                        .withArgument(Arg.SESSIONOVERRIDE)
                .withArgument(Arg.CALLBACKPORT,Sport)
               .withArgument(Arg.WDALOCALPORT,wdaPort)
                .withArgument(Arg.NODECONFIG,path)

                .usingPort(port));

            service.start();

    threadLocalDriver.setTLDriver(new AndroidDriver<MobileElement>(new URL("http://"+URL_+":"+"4444"+"/wd/hub"),dc));
    driver = threadLocalDriver.getTLDriver();
    wait = new WebDriverWait(driver, 10);

}


@AfterMethod
public synchronized void teardown(){
    if (driver != null) {
    driver.quit();
        service.stop();

// } } }

} ` ##TestClass

`package Tests;

import org.testng.annotations.Test;

import Configuration.BaseSetup; import Pages.LandingPage;

public class LandingPageTest extends BaseSetup { @Test (priority = 1) public void Verify_user_can_use_tourist_mode() { LandingPage page = new LandingPage(driver); page.sign_as_Tourist(); }

@Test (priority = 2)
public  void Verify_user_can_use_local_mode() {
    LandingPage page = new LandingPage(driver);
    page.sign_as_Local();
}

} `

Node Config File

{ "capabilities": [ { "deviceName": "SM_N9208", "platformName": "Android", "deviceId": "192.168.1.9:5556", "platformVersion": "7.0", "maxInstances": 1 } ], "configuration": { "cleanUpCycle": 2000, "timeout": 30000, "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "url": "http://localhost:5001/wd/hub", "host": "localhost", "port": 5001, "maxSession": 1, "register": true, "registerCycle": 5000, "hubPort": 4444, "hubHost": "localhost" } }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
amrsa1commented, May 3, 2019

well great its working now this last working node config

{ "capabilities": [ { "deviceName": "SM_N950F", "browserName": "SM_N950F", "deviceId": "192.168.1.4:5555", "platform": "Android", "version": "9", "maxInstances": 1 } ], "configuration": { "cleanUpCycle":2000, "timeout":30000, "timeout": 30000, "browserTimeout": 180, "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "url": "http://localhost:4800/wd/hub", "hubProtocol": "http", "maxSession": 1, "register": true, "registerCycle": 5000, "hubPort": 4444, "hubHost": "localhost" } }

1reaction
KazuCocoacommented, May 2, 2019

browserName is used to detect the test device. https://github.com/appium/java-client/issues/1138#issuecomment-488332203 If you set deviceName as SM_N9208, you probably should set the browserName as SM_N9208

And what about changing platformName => platform, platformVersion => version for grdi config like https://github.com/appium/ruby_lib/blob/master/grid/config.json and http://appium.io/docs/en/advanced-concepts/grid/ ?

{ "capabilities": [ { "deviceName": "SM_N9208", "platformName": "Android", "deviceId": "192.168.1.9:5556", "platformVersion": "7.0", "maxInstances": 1 } ], "configuration": { "cleanUpCycle": 2000, "timeout": 30000, "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "url": "http://localhost:5001/wd/hub", "host": "localhost", "port": 5001, "maxSession": 1, "register": true, "registerCycle": 5000, "hubPort": 4444, "hubHost": "localhost" } }
Read more comments on GitHub >

github_iconTop Results From Across the Web

org.openqa.selenium.WebDriverException ... - Stack Overflow
WebDriverException: Unable to parse remote response: <!DOCTYPE html> ... I am glad that you are able to find out root cause.
Read more >
Org.openqa.selenium.WebDriverException: Unable to parse ...
WebDriverException: Unable to parse remote response: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
Read more >
Original error: Unable to parse remote response - Issues/Bugs
Issue: Unable to parse remote response: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>. opened by amrsa1 on 2019-05-01.
Read more >
Unable to create a new remote session, please check the ...
Original error: Unable to parse remote response: <! ... Head--> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> ...
Read more >
Moderro IEM Management Software - Developer Guide
<head>5. <title>..:: JavaScript injection example ::.. </title>. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found