SeleniumHQ / docker-selenium

Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
http://www.selenium.dev/docker-selenium/
Other
7.9k stars 2.51k forks source link

Passing video name from desired capabilities #1121

Closed amuthansakthivel closed 3 years ago

amuthansakthivel commented 3 years ago

🚀 Feature Proposal

For now the video name is passed as an environment variable to the image - selenium/video:ffmpeg-4.3.1-20200920 Can we have this passed from the desired capabilities with key as "videoName" and value as "myfirstdockerseleniumtest". Now the video generated in the /video directory should be named as myfirstdockerseleniumtest.mp4 If this parameter is not passed then it should generate a random name or timestamp to generate the filename for the video generated.

Motivation

It will make job easy for test engineers to differentiate the videos generated from the containers with the customized test name. Generating the video with the same name would override the existing videos in the /video directory.

Example

Sample java code : DesiredCapabilities cap= new DesiredCapabilities(); cap.setBrowserName(browser); cap.setCapability("videoName", "myfirstdockerseleniumtest"); driver = new RemoteWebDriver(new URL("http://13.126.125.68:4444/wd/hub"),cap); driver.manage().window().maximize(); driver.get("https://google.com"); System.out.println(driver.getTitle()); driver.quit();

diemol commented 3 years ago

This has been now implemented in a way where users can pass any custom capability in the se:options block, and then this information will be saved in a directory structure which will contain a directory named with the sessionId, and inside it you'll find the video and the session capabilities.

Have a look at https://github.com/SeleniumHQ/docker-selenium#video-recording-screen-resolution-and-time-zones-in-a-dynamic-grid

MartykQ commented 3 years ago

@diemol Could you give an example how to do that in Java or Python?

diemol commented 3 years ago

https://github.com/diemol/selenium-4-demo/blob/master/src/test/java/com/saucelabs/demo/GridTest.java#L42

onurotlu commented 3 years ago

@diemol The question asks how to give a name for video file but the test code you indicate just makes the video recording option on. Is there a way to give a name for video file?

github-actions[bot] commented 3 years ago

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