All Projects → daudmalik06 → PhpScreenRecorder

daudmalik06 / PhpScreenRecorder

Licence: other
A slim PHP wrapper around ffmpeg to record screen,best for recording your acceptance test using selenium, easy to use and clean OOP interface

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to PhpScreenRecorder

Scrape Linkedin Selenium
`scrape_linkedin` is a python package that allows you to scrape personal LinkedIn profiles & company pages - turning the data into structured json.
Stars: ✭ 239 (+443.18%)
Mutual labels:  selenium, selenium-webdriver
TRA-Ticket-Booker
(已不適用新版臺鐵訂票系統,且不再更新)台灣鐵路訂票應用程式(臺鐵 / 台鐵 / 訂單程票 / 訂來回票),基於 Selenium + PyQt4。
Stars: ✭ 26 (-40.91%)
Mutual labels:  selenium, selenium-webdriver
Lambdium
headless chrome + selenium webdriver in AWS Lambda using the serverless application model
Stars: ✭ 246 (+459.09%)
Mutual labels:  selenium, selenium-webdriver
Panther
A browser testing and web crawling library for PHP and Symfony
Stars: ✭ 2,480 (+5536.36%)
Mutual labels:  selenium, selenium-webdriver
frameworkium-examples
Sample project which utilises frameworkium-core, a framework for writing maintainable Selenium and REST API tests and facilitates reporting and integration to JIRA.
Stars: ✭ 52 (+18.18%)
Mutual labels:  selenium, selenium-webdriver
Steward
PHP libraries that makes Selenium WebDriver + PHPUnit functional testing easy and robust
Stars: ✭ 215 (+388.64%)
Mutual labels:  selenium, selenium-webdriver
selenium-cheatsheet-java
A comprehensive list of selenium commands in Java
Stars: ✭ 20 (-54.55%)
Mutual labels:  selenium, selenium-webdriver
Selenoid
Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
Stars: ✭ 2,065 (+4593.18%)
Mutual labels:  selenium, selenium-webdriver
selenium-grid-docker-swarm
web scraping in parallel with Selenium Grid and Docker
Stars: ✭ 32 (-27.27%)
Mutual labels:  selenium, selenium-webdriver
ScatterFly
An attempt to improve user privacy by intelligent data obfuscation.
Stars: ✭ 49 (+11.36%)
Mutual labels:  selenium, selenium-webdriver
Thirtyfour
Selenium WebDriver client for Rust, for automated testing of websites
Stars: ✭ 191 (+334.09%)
Mutual labels:  selenium, selenium-webdriver
spydriver
🕵️ Lightweight utility to intercept WebDriver and WebElement method calls.
Stars: ✭ 24 (-45.45%)
Mutual labels:  selenium, selenium-webdriver
Selenium Jupiter
JUnit 5 extension for Selenium WebDriver
Stars: ✭ 185 (+320.45%)
Mutual labels:  selenium, selenium-webdriver
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (+427.27%)
Mutual labels:  selenium, selenium-webdriver
Selenium Remote Driver
Perl Bindings to the Selenium Webdriver server
Stars: ✭ 169 (+284.09%)
Mutual labels:  selenium, selenium-webdriver
google-meet-bot
Bot for scheduling and entering google meet sessions automatically
Stars: ✭ 33 (-25%)
Mutual labels:  selenium, selenium-webdriver
Webium
Webium is a Page Object pattern implementation library for Python (http://martinfowler.com/bliki/PageObject.html). It allows you to extend WebElement class to your custom controls like Link, Button and group them as pages.
Stars: ✭ 144 (+227.27%)
Mutual labels:  selenium, selenium-webdriver
Ayespy
A performant visual regression testing tool
Stars: ✭ 150 (+240.91%)
Mutual labels:  selenium, selenium-webdriver
frontend testing
Repository containing sample code used in a Frontend Testing workshop
Stars: ✭ 14 (-68.18%)
Mutual labels:  selenium, selenium-webdriver
python-appium-framework
Complete Python Appium framework in 360 degree
Stars: ✭ 43 (-2.27%)
Mutual labels:  selenium, selenium-webdriver

PHP Screen Recorder

A lightweight php wrapper around ffmpeg to record the screen, best for recording your acceptance tests using selenium, it's easy to use and clean OOP interface.

History

I was given a task to make an acceptance test suite which included recording videos of the tests. I was using selenium for the task and for the video recording, however, I was unable to find an elegant solution which is why i created this library.

Usage

One of the best features of this library is its ease of use.

The startRecording method is called when the user wants to start the recording after which this library will start the video recording in the background. When the user has completed their task they can call stopRecording to stop the recording .

Installation

The library is easily installed as a package through composer:

composer require dawood/phpscreenrecorder

that's it, nothing else is required for the installation

Examples

There are examples provided in examples folder as well.

Make sure, that you include the composer autoloader somewhere in your codebase.

Capture the screen

include "../vendor/autoload.php";

use dawood\PhpScreenRecorder\ScreenRecorder;

$screenRecorder=new ScreenRecorder();
$screenRecorder->setScreenSizeToCapture(1920,1080);

$screenRecorder->startRecording(__DIR__.DIRECTORY_SEPARATOR.'myVideo');
sleep(5+2);//doing random stuff
//when done stop recording
$screenRecorder->stopRecording();

print "video is saved at :\"".$screenRecorder->getVideo().'"'.PHP_EOL;

Selenium test example

public function testLoginUserCorrectly()
{
    $this->screenRecorder->setScreenSizeToCapture(1920,1080);
    $this->screenRecorder->startRecording(__DIR__."/videos/loginCorrectly.flv",2);
    $loginInput = [
        'username' => 'test',
        'password' => 'password'
    ];
    $this->visit('/')
        ->submitForm("#loginform > form",$loginInput)
        ->wait(3)
        ->see("Logout")
        ->wait(2);
    $this->screenRecorder->stopRecording(0);

}

Setting options

The ffmpeg shell command can accept different options: for a complete list of options you can visit: http://ffmpeg.org/ffmpeg.html

Wrapper Methods

  • setOptions accepts the options in the array. You can provide any option in following way:
      $options['-show_region'=>'1']
      $screenRecorder->setOptions($options);

Note: you have to write complete option including "-" ,
i had to do this way because there are some options which need "-" this and some which not so it's difficult to know for which option i have to set that that's why you have to provide complete option.

  • setScreenSizeToCapture screen size to capture, it accepts two arguments the first being the width and other being the height.

  • startRecording call this method after you have set all the desired options,
    this will start the screen recording. The method accepts two optional arguments, firstly the desired location to save the video file and secondly the number of seconds to sleep after starting the process. This is useful because ffmpeg takes 1-2 seconds to start the recording, the default value for this is 2 seconds. You can may change this according to your requirements.

  • stopRecording this will stop the screen recording. The method can also take one optional argument, the number of seconds to sleep after starting the process. This is useful because ffmpeg takes 1-2 seconds to start the recording.

  • getVideo returns the saved video file.

  • setBinary for this library you do not require any binary as everything is already included, however, if you need to use any other binary you can provide it using this method.

  • getCommandToRun returns the generated command that will be executed by library.
    This is useful to check how you have set the options or to debug.

  • getOptions returns an array of all the set options.

  • getBinary returns the currently set binary file i.e ffmpeg.

License

The PHP Screen Recorder is open-sourced software licensed under the MIT license.

Contribution

Thanks to all of the contributors , fork this repository and send me a pull request

Author

Dawood Ikhlaq and Open source community

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].