Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium Grid 4.0.0-alpha5 doesn't find commands (in embedded mode) #8130

Closed
asolntsev opened this issue Mar 23, 2020 · 11 comments
Closed

Selenium Grid 4.0.0-alpha5 doesn't find commands (in embedded mode) #8130

asolntsev opened this issue Mar 23, 2020 · 11 comments
Labels
C-build Build related issues (bazel and CI) C-grid C-java

Comments

@asolntsev
Copy link
Contributor

🐛 Bug Report

When I run grid commands as described in wiki, I see only help message.

To Reproduce

❯❯❯ java -jar selenium-server-4.0.0-alpha-5.jar

Selenium Server commands

A list of all the commands available. To use one, run `java -jar selenium.jar
commandName`.

  distributor  Adds this server as the distributor in a selenium grid.
  hub          A grid hub, composed of sessions, distributor, and router.
  info         Prints information for commands and topics.
  node         Adds this server as a node in the selenium grid.
  router       Creates a router to front the selenium grid.
  sessions     Adds this server as the session map in a selenium grid.
  standalone   The selenium server, running everything in-process.

...

Expected behaviour

A selenium grid server should be start with given command.

Environment

OS: Any (I use MacOS)
Browser: -
Browser version: -
Browser Driver version: -
Language Bindings version: 4.0.0-alpha-5
Selenium Grid version (if applicable): 4.0.0-alpha-5

The bug cause

File META-INF/services/org.openqa.selenium.cli.CliCommand in selenium-grid-4.0.0-alpha-5.jar contains only one line:

org.openqa.selenium.grid.sessionmap.httpd.SessionMapServer

but should contain all grid commands:

org.openqa.selenium.grid.distributor.httpd.DistributorServer
org.openqa.selenium.grid.commands.InfoCommand
org.openqa.selenium.grid.commands.MessageBusCommand
org.openqa.selenium.grid.node.httpd.NodeServer
org.openqa.selenium.grid.router.httpd.RouterServer
org.openqa.selenium.grid.sessionmap.httpd.SessionMapServer
org.openqa.selenium.grid.commands.Standalone
@ghost ghost added the needs-triaging label Mar 23, 2020
@diemol
Copy link
Member

diemol commented Mar 23, 2020

@asolntsev what was the command that you tried? It is not clear from the issue description.

@asolntsev
Copy link
Contributor Author

asolntsev commented Mar 23, 2020

@asolntsev what was the command that you tried? It is not clear from the issue description.

My command line was exactly like this:

java -jar selenium-server-4.0.0-alpha-5.jar

@diemol
Copy link
Member

diemol commented Mar 23, 2020

Ah ok, got it. Grid 4 is only giving the information about the available commands when no parameter is given:

java -jar selenium-server-4.0.0-alpha-5.jar                                                                                                                                                     ✔  19:20:52
Selenium Server commands

A list of all the commands available. To use one, run `java -jar selenium.jar
commandName`.

  distributor  Adds this server as the distributor in a selenium grid.
  hub          A grid hub, composed of sessions, distributor, and router.
  info         Prints information for commands and topics.
  node         Adds this server as a node in the selenium grid.
  router       Creates a router to front the selenium grid.
  sessions     Adds this server as the session map in a selenium grid.
  standalone   The selenium server, running everything in-process.

For each command, run with `--help` for command-specific help

Use the `--ext` flag before the command name to specify an additional classpath
to use with the server (for example, to provide additional commands, or to
provide additional driver implementations). For example:

  java -jar selenium.jar --ext example.jar:dir standalone --port 1234

As the output says,

To use one, run java -jar selenium.jar commandName

For example:

java -jar selenium-server-4.0.0-alpha-5.jar standalone                                                                                                                                SIGINT(2) ↵  19:22:48
19:22:52.732 INFO [EventBusOptions.createBus] - Creating event bus: org.openqa.selenium.events.local.GuavaEventBus
19:22:52.906 INFO [NodeOptions.lambda$addSystemDrivers$1] - Adding Capabilities {browserName: chrome} 13 times
19:22:52.908 INFO [NodeOptions.lambda$addSystemDrivers$1] - Adding Capabilities {browserName: firefox} 13 times
19:22:52.908 INFO [NodeOptions.lambda$addSystemDrivers$1] - Adding Capabilities {browserName: operablink} 13 times
19:22:52.908 INFO [NodeOptions.lambda$addSystemDrivers$1] - Adding Capabilities {browserName: safari} 1 times
19:22:52.954 INFO [LocalDistributor.add] - Added node d3c7789b-7aa6-4543-95e0-2f823de2bc83.
19:22:52.955 INFO [Host.lambda$new$0] - Changing status of node d3c7789b-7aa6-4543-95e0-2f823de2bc83 from DOWN to UP. Reason: http://192.168.1.7:4444 is ok
19:22:53.083 INFO [Standalone.lambda$configure$1] - Started Selenium standalone 4.0.0-alpha-5 (revision b3a0d621cc)

Could you please give it a try?

@asolntsev
Copy link
Contributor Author

@diemol My bad. Now I understand that it was the expected output. Sorry for miscommunication. :(

What I actually was trying to do is running embedded grid server.
Right in my test:

import org.openqa.selenium.grid.Main;

  @BeforeEach
  final void setUpGrid() throws Exception {
    int hubPort = findFreePort();
    Main.main(new String[]{"standalone", "--port", String.valueOf(hubPort)});
  }

In this case, "standalone" and any other commands are not found.
It's because file META-INF/services/org.openqa.selenium.cli.CliCommand in selenium-grid-4.0.0-alpha-5.jar contains only one line. But now I realized that the same file in selenium-server-4.0.0-alpha-5.jar contains all properties.

Maybe it's not directly a bug, but at least it may cause a confusion. Probably file selenium-grid-4.0.0-alpha-5.jar should not contain META-INF/services/org.openqa.selenium.cli.CliCommand at all.

@asolntsev
Copy link
Contributor Author

P.S. I don't see selenium-server-4.0.0-alpha-5.jar in maven central repository. How could I get access to the proper META-INF/services/org.openqa.selenium.cli.CliCommand then (if I want to use fully automated builds without need to manually download any jars)?

@asolntsev asolntsev changed the title Selenium Grid CLI 4.0.0-alpha5 doesn't find commands Selenium Grid 4.0.0-alpha5 doesn't find commands (in embedded mode) Mar 23, 2020
@AutomatedTester
Copy link
Member

@diemol Should we get something fixed here or close the issue?

@asolntsev
Copy link
Contributor Author

@AutomatedTester @diemol Yes, I suggest the following action point:

  • Add all possible commands to selenium-grid-4.0.0-alpha-5.jar:META-INF/services/org.openqa.selenium.cli.CliCommand

Alternatively,

  • Remove file selenium-grid-4.0.0-alpha-5.jar:META-INF/services/org.openqa.selenium.cli.CliCommand
  • Publish file selenium-server-4.0.0-alpha-5.jar to maven central repo

@barancev
Copy link
Member

@AutomatedTester Yes, we should fix META-INF/services/org.openqa.selenium.cli.CliCommand

@barancev barancev added C-build Build related issues (bazel and CI) C-grid C-java and removed R-awaiting answer labels Mar 26, 2020
@shs96c
Copy link
Member

shs96c commented Apr 9, 2020

First question: are you pulling this into a project by a maven dependency, or just grabbing the jar?
Presumably, you're using org.seleniumhq.selenium:selenium-grid:4.0.0-alpha-5 and pulling in a maven dep to a project. Is that right?

@asolntsev
Copy link
Contributor Author

@shs96c yes, I use selenium-grid-4.0.0-alpha-5.jar as Gradle dependency.

@lock
Copy link

lock bot commented May 20, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-build Build related issues (bazel and CI) C-grid C-java
Projects
None yet
Development

No branches or pull requests

5 participants