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

[Feat]: view Live screen of devices in novnc of selenium grid 4 via novnc port #19009

Open
krishtoautomate opened this issue Aug 20, 2023 · 6 comments
Labels

Comments

@krishtoautomate
Copy link

Is your feature request related to a problem? Please describe.
selenium grid 4 supports live view of browsers via no-vnc port but appium session cannot be viewed live though we use mjpegurl or port

Describe the solution you'd like
would like to see live view of devices screen wheres tests being executed on selenium grid with relay appium

Describe alternatives you've considered
is it possible to point appium mjpegurl to selenium grid sessions novnc port to see it live.
we have similar feature in appium inspector.

@KazuCocoa
Copy link
Member

Didn't appium:mjpegServerPort in UIA2 and XCUITest driver help?

@mykola-mokhnach
Copy link
Collaborator

novnc uses RFB protocol to communicate (also wrapped into websockets), which is something completely different from what MJPEG client would expect.
In theory it would be possible to write a plugin, which may connect to the RFB server, periodically request screen buffers, convert them to JPEGs if necessary and then expose it on some other local port, which MJPEG client could consume. In order to do it one must have a deep knowledge of the Remote Frame Buffer protocol and binary data processing in node.js ;)

@krishtoautomate
Copy link
Author

Didn't appium:mjpegServerPort in UIA2 and XCUITest driver help?

this doesn't show in same grid 4 UI. each URL needed to be opened in separate tab and also for large scale, this will not be ideal.

@krishtoautomate
Copy link
Author

novnc uses RFB protocol to communicate (also wrapped into websockets), which is something completely different from what MJPEG client would expect. In theory it would be possible to write a plugin, which may connect to the RFB server, periodically request screen buffers, convert them to JPEGs if necessary and then expose it on some other local port, which MJPEG client could consume. In order to do it one must have a deep knowledge of the Remote Frame Buffer protocol and binary data processing in node.js ;)

ya something like this can be done :

`const WebSocket = require('ws');
const axios = require('axios');

// Fetch the MJPEG stream from appium-wda
const mjpegUrl = 'your_appium_wda_mjpeg_url';
const response = await axios.get(mjpegUrl, { responseType: 'stream' });

// Create a WebSocket connection to the noVNC server
const ws = new WebSocket('ws://your_novnc_server_address:your_novnc_port');

response.data.on('data', frameData => {
// Forward the frame data to the noVNC server
ws.send(frameData, { binary: true });
});

response.data.on('end', () => {
// Close the WebSocket connection when the stream ends
ws.close();
});`

@jlipps
Copy link
Member

jlipps commented Aug 21, 2023

Seems like a great idea for a plugin @krishtoautomate! Let us know when you build it and we will link to it in the docs 😉

@krishtoautomate
Copy link
Author

krishtoautomate commented Sep 9, 2023

need help.

I buffered mjpeg video to nonvnc port : 7900

and specified below capabilities in selenium node stereotype configs

"se:noVncPort": 7900,
"se:vncEnabled": true,

and started node as:

java -jar selenium-server-4.12.1.jar node --config ./config/IOS-00008101-001C15A20AD2001E.toml --vnc-env-var START_XVFB

and failed to see vnc stream in grid while tests are running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants