cerberustesting / cerberus-core

The Open Source Test Automation Platform.
https://cerberus-testing.com
GNU General Public License v3.0
329 stars 100 forks source link

ERROR - java.lang.NullPointerException - with Selenium #2515

Closed Tyroonis closed 10 months ago

Tyroonis commented 10 months ago

When I start a RUN on Selenium 4.16 Grit I get a java.lang.NullPointerException.

cerberus-cerberus-1     | 2024-01-17 15:22:33 INFO  RunTestCaseV002:337 - Execution Requested : UUID=c254f264-2aa3-4269-8baf-a921af7f580b
cerberus-cerberus-1     | 2024-01-17 15:22:33 INFO  RunTestCaseService:59 - Execution Started : UUID=c254f264-2aa3-4269-8baf-a921af7f580b ID=  ID=117
cerberus-cerberus-1     | 2024-01-17 15:22:34 INFO  RobotServerService:146 - Start Robot Server (Selenium, Appium or Sikuli)
selenium-hub            | 15:22:34.892 INFO [LocalDistributor.newSession] - Session request received by the Distributor: 
selenium-hub            |  [Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:firefoxOptions: {args: [], profile: UEsDBBQACAgIANF6MVgAAAAAAAA...}, platformName: linux}]
cerberus-node-docker-1  | 15:22:34.936 INFO [DockerSessionFactory.apply] - Starting session for Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:firefoxOptions: {args: [], profile: UEsDBBQACAgIANF6MVgAAAAAAAA...}, platformName: linux}
cerberus-node-docker-1  | 15:22:34.939 INFO [DockerSessionFactory.apply] - Creating container...
cerberus-cerberus-1     | 2024-01-17 15:22:34 INFO  RecorderService:1067 - File saved : /opt/CerberusMedias/executions/117/robot_caps.json
cerberus-node-docker-1  | 15:22:35.076 INFO [Container.<init>] - Created container b2549f25fb0b859bf566e6029e13da89ea93768f209c3336e25240fbbce43237
cerberus-node-docker-1  | 15:22:35.078 INFO [Container.start] - Starting container b2549f25fb0b859bf566e6029e13da89ea93768f209c3336e25240fbbce43237
cerberus-node-docker-1  | 15:22:35.457 INFO [Container.inspect] - Inspecting container b2549f25fb0b859bf566e6029e13da89ea93768f209c3336e25240fbbce43237
cerberus-node-docker-1  | 15:22:35.469 INFO [DockerSessionFactory.apply] - Waiting for server to start (container id: b2549f25fb0b859bf566e6029e13da89ea93768f209c3336e25240fbbce43237, url http://172.28.0.6:4444/wd/hub)
cerberus-node-docker-1  | 15:22:39.364 INFO [DockerSessionFactory.apply] - Server is ready (container id: b2549f25fb0b859bf566e6029e13da89ea93768f209c3336e25240fbbce43237)
cerberus-cerberus-1     | 2024-01-17 15:22:41 INFO  ScheduledTaskRunner:117 - SchedulerInit Task triggered.
cerberus-cerberus-1     | 2024-01-17 15:22:41 INFO  ScheduledTaskRunner:119 - SchedulerInit Task ended.
cerberus-node-docker-1  | 15:22:43.425 INFO [LocalNode.newSession] - Session created by the Node. Id: 814591ef-7029-47f9-9b77-76d53ed1a76d, Caps: Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 120.0.1, moz:accessibilityChecks: false, moz:buildID: 20231129155202, moz:firefoxOptions: {args: [], profile: UEsDBBQACAgIANF6MVgAAAAAAAA...}, moz:geckodriverVersion: 0.33.0, moz:headless: false, moz:platformVersion: 6.1.0-13-amd64, moz:processID: 137, moz:profile: /tmp/rust_mozprofile7DXn1j, moz:shutdownTimeout: 60000, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://172.28.0.5:4444/sessio..., se:forwardCdp: ws://172.28.0.6:4444/sessio..., se:noVncPort: 7900, se:vnc: ws://172.28.0.5:4444/sessio..., se:vncEnabled: true, se:vncLocalAddress: ws://172.28.0.6:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
selenium-hub            | 15:22:43.455 INFO [LocalDistributor.newSession] - Session created by the Distributor. Id: 814591ef-7029-47f9-9b77-76d53ed1a76d 
selenium-hub            |  Caps: Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 120.0.1, moz:accessibilityChecks: false, moz:buildID: 20231129155202, moz:firefoxOptions: {args: [], profile: UEsDBBQACAgIANF6MVgAAAAAAAA...}, moz:geckodriverVersion: 0.33.0, moz:headless: false, moz:platformVersion: 6.1.0-13-amd64, moz:processID: 137, moz:profile: /tmp/rust_mozprofile7DXn1j, moz:shutdownTimeout: 60000, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: linux, proxy: {}, se:bidiEnabled: false, se:cdp: ws://172.28.0.5:4444/sessio..., se:forwardCdp: ws://172.28.0.6:4444/sessio..., se:noVncPort: 7900, se:vnc: ws://172.28.0.5:4444/sessio..., se:vncEnabled: true, se:vncLocalAddress: ws://172.28.0.6:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
cerberus-cerberus-1     | 17-Jan-2024 15:22:43.484 INFO [Forwarding newSession on session null to remote] org.openqa.selenium.remote.ProtocolHandshake.createSession Detected dialect: W3C
cerberus-cerberus-1     | 2024-01-17 15:22:43 INFO  RecorderService:1067 - File saved : /opt/CerberusMedias/executions/117/robot_server_caps.json
cerberus-cerberus-1     | 2024-01-17 15:22:43 ERROR RobotServerService:493 - java.lang.NullPointerException
cerberus-cerberus-1     | java.lang.NullPointerException: null
cerberus-cerberus-1     |   at org.cerberus.core.engine.execution.impl.RobotServerService.getIPOfNode(RobotServerService.java:1159) ~[classes/:?]
cerberus-cerberus-1     |   at org.cerberus.core.engine.execution.impl.RobotServerService.startServer(RobotServerService.java:438) ~[classes/:?]
cerberus-cerberus-1     |   at org.cerberus.core.engine.execution.impl.ExecutionRunService.executeTestCase(ExecutionRunService.java:281) ~[classes/:?]
cerberus-cerberus-1     |   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
cerberus-cerberus-1     |   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
cerberus-cerberus-1     |   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
cerberus-cerberus-1     |   at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
cerberus-cerberus-1     |   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.3.27.jar:5.3.27]
cerberus-cerberus-1     |   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-5.3.27.jar:5.3.27]
cerberus-cerberus-1     |   at com.sun.proxy.$Proxy103.executeTestCase(Unknown Source) ~[?:?]
cerberus-cerberus-1     |   at org.cerberus.core.engine.execution.impl.RunTestCaseService.runTestCase(RunTestCaseService.java:79) ~[classes/:?]
cerberus-cerberus-1     |   at org.cerberus.core.servlet.zzpublic.RunTestCaseV002.doGet(RunTestCaseV002.java:343) ~[classes/:?]
cerberus-cerberus-1     |   at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[servlet-api.jar:?]
cerberus-cerberus-1     |   at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[servlet-api.jar:?]
cerberus-cerberus-1     |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) ~[log4j-web-2.17.2.jar:2.17.2]
cerberus-cerberus-1     |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[catalina.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) ~[tomcat-coyote.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-coyote.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808) ~[tomcat-coyote.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) ~[tomcat-coyote.jar:8.5.41]
cerberus-cerberus-1     |   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:8.5.41]
cerberus-cerberus-1     |   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
cerberus-cerberus-1     |   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
cerberus-cerberus-1     |   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:8.5.41]
cerberus-cerberus-1     |   at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_212]
cerberus-cerberus-1     | 2024-01-17 15:22:43 INFO  ExecutionRunService:851 - {"country":"FR","queueId":18,"controlStatus":"FA","videos":[],"type":"testCaseExecution","robot":"Linux_firefox","screenSize":"","executor":"Admin","id":117,"tag":"Admin.20240117-152233","robotHost":"selenium-hub","conditionVal3":"","conditionVal2":"","test":"Examples","conditionVal1":"","usrModif":"Admin","previousExeId":0,"conditionVal2Init":"","version":"","testCaseVersion":0,"revision":"","usrCreated":"Admin","system":"DEFAULT","robotSessionId":"814591ef-7029-47f9-9b77-76d53ed1a76d","robotPort":"4444","robotExecutor":"EXE-1","conditionVal1Init":"","status":"WORKING","robotProvider":"NONE","crbVersion":"Cerberus-4.17","description":"Search for Cerberus Website","platform":"LINUX","browser":"firefox","end":1705504963788,"conditionVal3Init":"","robotProviderSessionId":"814591ef-7029-47f9-9b77-76d53ed1a76d","controlMessage":"The test case failed to be executed. More lickely due to an error in the test or in Cerberus configuration. The test case failed to be executed. Could not start Robot Server. java.lang.NullPointerException.","start":1705504953925,"userAgent":"","testcase":"0001A","url":"www.google.fr//","verbose":1,"environment":"PROD","robotDecli":"Linux_firefox","manualExecution":"N","application":"Google","build":"","conditionOperator":"always","environmentData":"PROD"}
cerberus-cerberus-1     | 2024-01-17 15:22:43 INFO  ExecutionRunService:870 - Execution Finished : UUID=c254f264-2aa3-4269-8baf-a921af7f580b ID=117 RC=FA TestName=PROD.FR...Examples_0001A_Search for Cerberus Website
cerberus-cerberus-1     | 2024-01-17 15:22:44 INFO  ScheduledTaskRunner:117 - SchedulerInit Task triggered.
cerberus-cerberus-1     | 2024-01-17 15:22:44 INFO  ScheduledTaskRunner:119 - SchedulerInit Task ended.

Cerberus and selenium are running on the same host with docker.

The session is also started on the Selenium Grit but then hangs and is then killed during the health check.

Here my docker-compose.yml

version: '3'
services:
  database:
    image: cerberustesting/cerberus-db-mysql:latest
    expose:
      - "3306"
    ports:
      - "13306:3306"
    volumes:
      - ./localdata/mysql-db:/var/lib/mysql
    restart: always
    networks:
            grid:
  cerberus:
    image: cerberustesting/cerberus-as-tomcat:latest
    environment:
      - DATABASE_HOST=database
      - DATABASE_PORT=3306
    ports:
      - "8080:8080"
    volumes:
      - ./localdata/cerberusmedia:/opt/CerberusMedias/
    restart: always
    depends_on:
      - database
    links:
      - database
    networks:
            grid:
  selenium-hub:
    image: selenium/hub:4.16
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
    networks:
            grid:

  node-docker:
    image: selenium/node-docker:4.16
    volumes:
      - assets:/opt/selenium/assets
      - ./config.toml:/opt/bin/config.toml
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    networks:
            grid:

volumes:
    assets:

networks:
    grid:
vertigo17 commented 10 months ago

Selenium 4 is not yet supported.

see https://github.com/cerberustesting/cerberus-core/issues/2431

I beleive the purpose of using Selenium is to get support on latest browser version. If so, and until compatibility is ready, you can use the following Dockerfile: https://github.com/cerberustesting/cerberus-robot-extension/tree/master/docker

vertigo17 commented 10 months ago

duplicate of #2431