aerokube / selenoid

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
https://aerokube.com/selenoid/latest/
Apache License 2.0
2.6k stars 324 forks source link

Find out which session I am on #164

Closed anujitas closed 7 years ago

anujitas commented 7 years ago

When I am running my test case and view it on Selenoid-UI (VNC tab) I see there is an "unknown" property specified there. When I route my test case through GGR, The unknown property changes to "test" ie. the username. First I would like to ask what is this "unknown". I want to know that is there any possibility to see which test case I am running can be viewed on VNC tab. Or like anything specific to diffrentiate between many instances running on same browser & version. Also I want to know that is there any possibility to run multiple selenoid with single Selenoid-UI.

vania-pooh commented 7 years ago

@Infobeans-Anujita 1) unknown means unknown user. The user name is being extracted from basic HTTP authentication headers (mainly needed for statistics). So if you access Selenoid like:

http://my-user:any-password@selenoid-host.example.com:4444/wd/hub

... you will see that user name changes to my-user (although Selenoid does not have any authentication).

2) Selenoid UI is intended to be used with only one Selenoid because it is a local tests debugging tool. 3) Regarding test case name. @lanwen - am I right stating that Selenoid UI currently has no way to differentiate session by test case name?

lanwen commented 7 years ago

UI just renders the output of /status handle. If your test is running on unnamed quota (without basic auth) it will be shown as unknown in the interface. Otherwise, it should show your quota name (name in basic auth).

For now, there is no way to provide test-case name to UI. It's really hard to differentiate similar sessions between each other... that's why UI is recommended as a debug tool for special cases (thanks to docker, session can be reproduced locally).

@vania-pooh But I think we can make maybe special capability which can be shown in UI? WDYT?

vania-pooh commented 7 years ago

@lanwen so far as I know e.g. Zalenium has something like testCaseName. Let's add this capability information to /status in this issue.

anujitas commented 7 years ago

Thanks a lot for your concern guyz !!! The API /status provides us with the session id of VNC and all other details. My scenario which I want to accomplish is that If I have 100 Test cases running routing through GGR, and I am running these cases from different different machines, Please tell me how will I come to know that which test case is routed on which machine.

vania-pooh commented 7 years ago

@Infobeans-Anujita during the previous week we implemented this here: https://github.com/aerokube/ggr/issues/97 This is already released as aerokube/ggr:1.2.5.

anujitas commented 7 years ago

Thanks a lot for your support @vania-pooh @lanwen.

anujitas commented 7 years ago

@vania-pooh When I am trying to find out the details of the port using curl http://IP:4444/session_id , I am getting 404 page not found error. I am not able to see the current port details. Please tell me the IP which we are specifying here is of selenoid right? Its not of GGR? My scenario is -> I have 5 machines, on each selenoid and selenloid-UI is up. On one of the machine GGR is up. I have specified all the 5 machine's host in test.xml file of that GGR. Now I am running my test case from each machine giving the hub_url of GGR. As we know that GGR routes the test randomly to any of the specified hosts. @vania-pooh Please tell me how will we come to know that the test case running from (eg. ) machine 3 is routed on which selenoid-UI so that we can go to that particular host and view our case running. Thanks in advance !

vania-pooh commented 7 years ago

@Infobeans-Anujita you're using incorrect URL to get host by session ID. Should be:

http://ggr-ip:4444/host/session_id

This only works with latest ggr release 1.2.5 so you should use Ggr IP address.

anujitas commented 7 years ago

@vania-pooh @lanwen Is it possible that we only have GGR up in our machine, and we have grids up and the host name for those grids are defined in our test.xml file. Can GGR point to the existing grids? Selenoid and Selenoid-UI is down as of now. When I am doing this, I am getting the error of "WebDriverException: Message: cannot create session firefox-46.0 on any hosts after 1 attempt(s), last host error was: Error forwarding the new session cannot find : Capabilities" Can you please help me out with this? Thanks in advance !

vania-pooh commented 7 years ago

@Infobeans-Anujita yes, Ggr can work either with standard Selenium server or with Selenoid or with any other Selenium API implementation. You are getting this error probably because your browser name and version on respective host does not equal to what you are specifying in test and in Ggr config. E.g. you wish to use Firefox 46.0. In that case you need to: 1) Have a node with browserName = firefox and version = 46.0 registered to respective hub host. 2) Have a browser in Ggr XML file with exactly the same name and version. 3) You test should also provide capabilities with the same browserName and version. If your version is the default one in Ggr XML file, then you can omit the version in test. An example of how capabilities can look like in Java:

final DesiredCapabilities browser = new DesiredCapabilities("firefox", "46.0", Platform.LINUX);
c0dehu1k commented 7 years ago

Hey @vania-pooh @lanwen , Please let me know if we have an IRC channel for selenoid.

anujitas commented 7 years ago

@vania-pooh @lanwen When I am trying to use curl http://ggr-ip:4444/host/session_id, I am getting an error of unknown host.

vania-pooh commented 7 years ago

@ersuniljoshi we have a Telegram channel here: https://telegram.me/aerokube You can also send personal questions to support@aerokube.com.

vania-pooh commented 7 years ago

@Infobeans-Anujita e.g. if you have Ggr host with IP 192.168.0.1, session ID f155a64a24f6767e98747dabf0d6a60bb28f2610-457c-497f-a776-9d905fe6012f, username test and password test-password you should do request like the following:

$ curl -s http://test:test-password@192.168.0.1:4444/host/f155a64a24f6767e98747dabf0d6a60bb28f2610-457c-497f-a776-9d905fe6012f
{"Name":"192.168.0.1","Port":4444,"Count":5,"Username":"","Password":""}
vania-pooh commented 7 years ago

@Infobeans-Anujita did you manage to resolve this issue?

anujitas commented 7 years ago

Yes, I am able to see the details of the port.Thanks a lot for your help !!

vania-pooh commented 7 years ago

Ok, closing then.

vania-pooh commented 7 years ago

Forgot to add showing capabilities in /status.

anujitas commented 7 years ago

Thanks a lot @vania-pooh @aandryashin . It would be very helpful that we can see the TestCaseName in /status. This change is in selenoid-ui:1.3.2? Right? Do I need to spin the docker image of this specific version?

lanwen commented 7 years ago

Not yet in UI. Will be in a few days after release of selenoid

vania-pooh commented 7 years ago

@Infobeans-Anujita this will be available in the upcoming release. Not yet released.