Не удается запустить тестирование пользовательского интерфейса PhantomJS через удаленный веб-драйвер Selen - PullRequest
0 голосов
/ 27 марта 2019

Я пытаюсь использовать phantomJS через удаленный веб-драйвер для тестирования пользовательского интерфейса.Вот шаги, которые я выполнил:

Phantom JS:

Я скачал версию Windows отсюда из-за проблемы: https://github.com/mrorgues/PhantomJSCustomEdition/tree/builds

Selenium Hub:

java -jar  selenium-server-standalone-3.14.0.jar -role hub

Phantom JS Node:

phantomjs --webdriver=7777 --webdriver-selenium-grid-hub=http://127.0.0.1:4444

Когда я пытаюсь получить доступ к концентратору через URL-адрес, который я вижуэто хорошо:

enter image description here

Вот как я инициализирую драйвер для запуска моих тестов:

DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
String urlString = "http://HubHostName:4444/wd/hub";
WebDriver driver = new RemoteWebDriver(new URL(urlString), capabilities);

У меня также естьпробовал это:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName","phantomjs");
String urlString = "http://HubHostName:4444/wd/hub";
WebDriver driver = new RemoteWebDriver(new URL(urlString), capabilities);

Но я всегда получаю следующее сообщение об ошибке:



    
    Error 500 Server Error
    
    HTTP ERROR 500
    Problem accessing /wd/hub/session. Reason:
 Server Error

Причина:

java.io.IOException: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
      "desiredCapabilities": {
        "browserName": "phantomjs"
      },
      "requiredCapabilities": {},
      "capabilities": {
        "desiredCapabilities": {
          "browserName": "phantomjs"
        },
        "requiredCapabilities": {},
        "alwaysMatch": {
          "browserName": "phantomjs"
        },
        "firstMatch": []
      }
    }
    	at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:138)
    	at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:69)
    	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.handle(ScopedHandler.java:143)
    	at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)
    	at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    	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(Unknown Source)
    Caused by: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
      "desiredCapabilities": {
        "browserName": "phantomjs"
      },
      "requiredCapabilities": {},
      "capabilities": {
        "desiredCapabilities": {
          "browserName": "phantomjs"
        },
        "requiredCapabilities": {},
        "alwaysMatch": {
          "browserName": "phantomjs"
        },
        "firstMatch": []
      }
    }
    	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:83)
    	... 32 more
    Caused by: java.lang.IllegalArgumentException: First match w3c capabilities is zero length
    	at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:164)
    	at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:149)
    	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:104)
    	at org.openqa.grid.web.servlet.handler.WebDriverRequest.extractDesiredCapability(WebDriverRequest.java:66)
    	... 37 more
    

Причина:

org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
      "desiredCapabilities": {
        "browserName": "phantomjs"
      },
      "requiredCapabilities": {},
      "capabilities": {
        "desiredCapabilities": {
          "browserName": "phantomjs"
        },
        "requiredCapabilities": {},
        "alwaysMatch": {
          "browserName": "phantomjs"
        },
        "firstMatch": []
      }
    }
    	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:83)
    	at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:69)
    	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.handle(ScopedHandler.java:143)
    	at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)
    	at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    	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(Unknown Source)
    Caused by: java.lang.IllegalArgumentException: First match w3c capabilities is zero length
    	at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:164)
    	at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:149)
    	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:104)
    	at org.openqa.grid.web.servlet.handler.WebDriverRequest.extractDesiredCapability(WebDriverRequest.java:66)
    	... 37 more
    

Причина:

java.lang.IllegalArgumentException: First match w3c capabilities is zero length
    	at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:164)
    	at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:149)
    	at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:104)
    	at org.openqa.grid.web.servlet.handler.WebDriverRequest.extractDesiredCapability(WebDriverRequest.java:66)
    	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:83)
    	at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:69)
    	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.handle(ScopedHandler.java:143)
    	at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)
    	at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    	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(Unknown Source)
    

Работает наПричал: // 9.4.8.v20180619
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...