|
| 1 | +# PyDesktopBrowserRecorder |
| 2 | + This project allows you to record your desktop or the browser during an automated test using selenium's webdriver |
| 3 | + |
| 4 | + To install it, just open a terminal and execute: |
| 5 | + pip install pydesktopbrowerrecorder |
| 6 | + |
| 7 | + PiPY Project: https://pypi.org/project/pydesktopbrowerrecorder/ |
| 8 | + |
| 9 | + Once installed, you just have to make the following import: |
| 10 | + from selenium_browser_desktop_recorder import SeleniumBrowserRecorder |
| 11 | + |
| 12 | + Then you create a SeleniumBrowserRecorder object, you have two modes. |
| 13 | + First mode: |
| 14 | + |
| 15 | + obj = SeleniumBrowserRecorder(folder,encoding) |
| 16 | + - folder: Folder where we want to create the folder that will contain the videos for our recording session |
| 17 | + - encoding: Encoding of the video. We only assure that using ".mp4" will work |
| 18 | + This way, when you start the recording session, the desktop will be recorded until we stop the recording session |
| 19 | + |
| 20 | + But you can also provide a third parameter: |
| 21 | + obj = SeleniumBrowserRecorder(folder,encoding,driver) |
| 22 | + - driver: A webdriver object |
| 23 | + In this case, we will record only the browser window(s) that are being controlled by that webdriver object |
| 24 | + |
| 25 | + To start the recording session once we build the object we only have to use this method: |
| 26 | + obj.startRecordingSession() |
| 27 | + And our object will start recording in a parallel thread |
| 28 | + |
| 29 | + To stop the recording session we only have to: |
| 30 | + obj.stopRecordingSession() |
| 31 | + The video will be saved and the threads finished |
| 32 | + |
| 33 | + NOTE: If we are recording a browser and the size of it changes, we will stop the current video and start a new one with the new |
| 34 | + size of the window |
| 35 | + |
| 36 | +NOTE: This was developed using the following versions of the following external libraries: |
| 37 | +- imageio_ffmpeg = 0.4.5 |
| 38 | +- numpy~=1.22.2 |
| 39 | +- imageio==2.15.0 |
| 40 | +- PyAutoGUI~=0.9.53 |
| 41 | +- selenium~=4.1.0 |
| 42 | +- Pillow~=9.0.1 |
0 commit comments