Download the PHP package shimabox/screru without Composer
On this page you can find all versions of the php package shimabox/screru. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shimabox/screru
More information about shimabox/screru
Files in shimabox/screru
Package screru
Short Description It has a function to supplement php-webdriver
License MIT
Homepage https://github.com/shimabox/screru
Rated 1.00 based on 1 reviews
Informations about the package screru
Screru
Screru is a library that supplements php-webdriver
Description
Screru is a library that supplements php-webdriver. It provides the following functions.
- Trait for PHPUnit is available
- Full screenshot
- Capture can be done when the assertion fails
- Screenshot of element
- Can control the style of the element when scrolling the screen in screen capture.
Supports Firefox (WebDriverBrowserType::FIREFOX), Chrome (WebDriverBrowserType::CHROME) and IE (WebDriverBrowserType::IE).
Demo
Requirements
- PHP 5.6+ or newer
- Composer
- Java(JDK) >=1.8
Installation
Via composer.
Develop.
- Copy the
.env.default
file and create an.env
file.
Setting (.env | .env.default)
If you need to change the default settings, copy the .env.default
file, create an .env
file, and modify the .env
file.
The default setting looks at .env.default
file.
Key | Description | Default | Example |
---|---|---|---|
SELENIUM_SERVER_URL | selenium server url. | http://localhost:4444/wd/hub | |
OVERRIDE_DEFAULT_USER_AGENT | you can override the default User-agent. | Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1 | |
LOCAL_PORT | local port It is for unittest. |
8000 | |
ENABLED_CHROME_DRIVER | If true it will enable ChromeDriver. | true | |
ENABLED_FIREFOX_DRIVER | If true it will enable geckodriver. | true | |
ENABLED_IE_DRIVER | If true it will enable IEDriverServer. | blank(false) | |
ENABLED_CHROME_HEADLESS | true to start headless chrome. | true | |
ENABLED_FIREFOX_HEADLESS | true to start headless firefox. | true | |
IS_PLATFORM_WINDOWS | true to platform is windows. For windows, be sure to set to true. |
blank(false) | |
CHROME_DRIVER_PATH | Describe the webdriver path if necessary. | blank | /home/user/screru/chromedriver |
FIREFOX_DRIVER_PATH | Describe the webdriver path if necessary. | blank | /Applications/MAMP/htdocs/screru/geckodriver |
IE_DRIVER_PATH | Describe the webdriver path if necessary. | blank | /c/xampp/htdocs/screru/IEDriverServer.exe |
Preparation
Download selenium-server-standalone, ChromeDriver, geckodriver, IEDriverServer etc.
Platform | selenium-server-standalone | ChromeDriver | geckodriver | IEDriverServer |
---|---|---|---|---|
Mac | 3.8.1 | 81.0.4044.69 | 0.26.0 | - |
Windows(64bit) | 3.8.1 | 75.0.3770.90 | 0.24.0 | 3.141.59 |
Linux(CentOS 6.9) | 3.8.1 | - | 0.24.0 | - |
Linux(Ubuntu trusty) | 3.8.1 | 75.0.3770.90 | 0.24.0 | - |
Use downloader.
-
e.g) For Mac.
-
e.g) For Windows.
- e.g) For Linux.
@see selenium-downloader/README.md at master · shimabox/selenium-downloader · GitHub
macOS
-
Add the path to ChromeDriver and geckodriver to your Path environment variable.
-
e.g) ChromeDriver
- e.g) geckodriver
-
- Or, write the driver's path in the
.env
file
Please give execute permission (chmod +x
)
e.g)
Run selenium-server-standalone.
windows(64bit)
.env
- Edit
The value of IS_PLATFORM_WINDOWS
must be set to true
.
Run selenium-server-standalone.
Note.
When this error is displayed, please refer to the following link.
- Rantings of a Selenium Contributor: You're Doing It Wrong: IE Protected Mode and WebDriver
- internet settings.png (2718×1068)
It is solved by setting the security mode of IE Internet option to ON in all zones.
Linux (CentOS 6.9)
java
-
install
- version 1.8>=
Firefox
- install
or
- version 60.3.0
Xvfb
- install
Path
-
Add the path to geckodriver to your Path environment variable.
- Or, write the driver's path in the
.env
file
Please give execute permission (chmod +x
)
e.g)
.env
- Edit
Run selenium-server-standalone.
-
Run Xvfb & selenium-server-standalone
- Stop Xvfb & selenium-server-standalone & geckodriver
Linux (Ubuntu trusty)
Please refer to this setting.
Usage
-
Basic Usage.
-
Control the style of the element when scrolling the screen.
-
When you want to change the default selenium server url.
-
When you want to change the default UserAgent.
-
When using with PHPUnit.
- If you want to capture when an assertion fails.
- or call the function below.
Headless Chrome
For the latest chrome, you can use headless mode.
- Edit
Headless Firefox
For the latest firefox, you can use headless mode.
- Edit
Example
$ php example/assertion_of_title.php
- example/assertion_of_title.php
- Execute a title assertion.
$ php example/example.php
- example/example.php
- Transit to designated URL (Google).
- Perform fullscreen capture.
- Perform screen element capture.
- example/example.php
$ php example/headless_chrome.php
- example/headless_chrome.php
- Transit to designated URL (Google).
- Perform fullscreen capture.
- example/headless_chrome.php
$ php example/headless_firefox.php
- example/headless_firefox.php
- Transit to designated URL (Google).
- Perform fullscreen capture.
- example/headless_firefox.php
$ php example/screenshot.php
- example/screenshot.php
- Transit to designated URL (Google).
- Perform fullscreen capture.
- Perform screen capture.
- example/screenshot.php
$ php example/element_screenshot.php
- example/element_screenshot.php
- Transit to designated URL (Google).
- Perform screen element capture.
- example/element_screenshot.php
$ php example/controll_display_state_of_elements.php
- example/controll_display_state_of_elements.php
- Transit to designated URL (Google).
- Perform fullscreen capture.
- Control the style of the element when scrolling the screen.
- Perform screen element capture.
- example/controll_display_state_of_elements.php
Testing
Start PHP's built-in Web Server.
Match port with .env
- LOCAL_PORT
.
Run test.
License
The MIT License (MIT). Please see License File for more information.
All versions of screru with dependencies
facebook/webdriver Version ^1.7
vlucas/phpdotenv Version ^2.4
shimabox/url-status Version ^1.0
shimabox/selenium-downloader Version ~0.3