cerberustesting / cerberus-robot-extension

Cerberus add-on that provide extended feature to the robots like image recognition or robot file manipulation.
http://www.cerberus-testing.org
GNU General Public License v3.0
6 stars 3 forks source link

uploadRobotFile returns Action Error : java.lang.NullPointerException #26

Open j0hnsa opened 4 months ago

j0hnsa commented 4 months ago

Hello, while trying to use the uploadRobotFile action a java.lang.NullPointerException occurs. image

the action is configured like this: image

Can you please advise?

vertigo17 commented 4 months ago

Can you confirm that the robot extention runs on a windows system ? You configured a Windows path and logs looks like docker based so I guess running under Linux. If using a standard docker image path should be more like /home/seluser/Downloads/test.json That way the file will be created on the robot side directly inside Download folder. Ready to be uploaded from the browser to your application.

j0hnsa commented 4 months ago

It does run on windows system, is this action limited to linux hosts?

vertigo17 commented 4 months ago

There are no reason that this shouls not work on windows. I will have a look why npe was raized

j0hnsa commented 3 months ago

I've tested with linux and the error seems to be present too, maybe I'm missing something VirtualBox_centos9_15_07_2024_22_50_32 VirtualBox_centos9_15_07_2024_22_51_03

vertigo17 commented 3 months ago

Thanks for the log. I will try to reproduce that.

vertigo17 commented 3 months ago

A couple of question that may help to identify the issue: Did you secure that folder C:\CerberusData\ or whatever folder you specified on your test under a linux docker image existed ? Can you test putting /home/seluser./downloads/test.json after making sure that folder /home/seluser/Downloads/ exist ? Also secure that parameter -a (--authorisedFolderScope) has been feed with /home/seluser/Downloads/ or docker compose include it this way:

  selenium-node-chrome:
    image: cerberus-node-chrome
    environment:
      HUB_HOST: selenium-hub
      SE_OPTS: -servlets org.cerberus.robot.extension.sikuli.ExecuteSikuliAction -servlets org.cerberus.robot.extension.filemanagement.ExecuteFilemanagementAction -servlets org.cerberus.robot.extension.management.ExecuteManagementAction
      JAVA_OPTS: -DauthorisedFolderScope=/home/seluser/Downloads
    depends_on:
      - selenium-hub
    expose:
      - "5900"
    ports:
      - "XXXXXX:5900"
    volumes:
      - /etc/localtime:/etc/localtime:ro
    restart: always
    shm_size: 512mb
    deploy:
      resources:
        limits:
          cpus: '0.8'
          memory: 1548M
vertigo17 commented 3 months ago

From your logs, I see that -a (--authorisedFolderScope) has been feed with null. For sure that will have a strange behaviour. Let me know when you can test with that parameter defined.

j0hnsa commented 3 months ago

I'm not being able to launch a node with the argument -a, an exception is raised, can you please advise on how to use it?

Below is one example of the command I tried to use with the -a:

java -cp "selenium-server-standalone-3.141.59.jar;cerberus-robot-extension-1.8-SNAPSHOT-full.jar" org.openqa.grid.selenium.GridLauncherV3 -role node -hub http://127.0.0.1:4444/grid/register -port 4445 -a "C:\selenium" -servlets org.sikuliserver.ExecuteSikuliAction -servlets org.cerberus.robot.extension.sikuli.ExecuteSikuliAction -servlets org.cerberus.robot.extension.filemanagement.ExecuteFilemanagementAction -servlets org.cerberus.robot.extension.management.ExecuteManagementAction Exception in thread "main" com.beust.jcommander.ParameterException: Was passed main parameter '-a' but no main parameter was defined in your arg class at com.beust.jcommander.JCommander.initMainParameterValue(JCommander.java:936) at com.beust.jcommander.JCommander.parseValues(JCommander.java:752) at com.beust.jcommander.JCommander.parse(JCommander.java:340) at com.beust.jcommander.JCommander.parse(JCommander.java:319) at org.openqa.grid.selenium.GridLauncherV3.parse(GridLauncherV3.java:218) at org.openqa.grid.selenium.GridLauncherV3.lambda$buildLaunchers$7(GridLauncherV3.java:271) at org.openqa.grid.selenium.GridLauncherV3.lambda$launch$0(GridLauncherV3.java:86) at java.base/java.util.Optional.map(Optional.java:265) at org.openqa.grid.selenium.GridLauncherV3.launch(GridLauncherV3.java:86) at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:70)