2017 © Pedro Peláez
 

library laravel-ff-webdriver

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

image

lionmm/laravel-ff-webdriver

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

  • Wednesday, November 15, 2017
  • by LionMM
  • Repository
  • 2 Watchers
  • 2 Stars
  • 45 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Webdriver adapter (for Larave or standalone usage)

Latest Stable Version Total Downloads License, (*1)

GitHub tag GitHub release Github All Releases, (*2)

Selenium Firefox web-driver adapter (for Laravel 5.2.* and standalone use), (*3)

This package uses the facebook's php-webdriver library, (*4)

Collect all mostly used methods in one class and give providers and aliases for working vs it, (*5)

Now can be used standalone, (*6)

Laravel supporting

  • Laravel 5.3.x: in developing, (*7)

  • Laravel 5.2.x: 1.0.1, (*8)

  • Laravel 5.1.x: 0.1.2, (*9)

  • Laravel < 5.1: not supported, (*10)

Quick start

Install

Run composer require lionmm/laravel-ff-webdriver, (*11)

Laravel 5.1.x to 5.2.x

In your config/app.php add LionMM\WebDriver\WebDriverServiceProvider::class, to the end of the providers array, (*12)

'providers' => array(

    ...
    LionMM\WebDriver\WebDriverServiceProvider::class,
),

Add the WebDriver facade to the end of the aliases array as well, (*13)

'aliases' => array(

    ...
    'WebDriver' => LionMM\WebDriver\Facades\WebDriver::class,
),

Usage

Selenium requirement

For using library you must install and run Selenium server, (*14)

By default, library try to connect to http://localhost:4444/wd/hub, (*15)

You can change that path in config/webdriver.php (see above), (*16)

Using library

Best way - using Facade by alias WebDriver::method(), (*17)

Also, you can make instance of \LionMM\WebDriver\WebDriver class, (*18)

<?php

use LionMM\WebDriver\WebDriver;

class Foo {

    public function Bar()
    {
        $webDriver = \App::make('webdriver'); // use \App::make for DI and 'webdriver' for singleton
    }
}

OR, (*19)

<?php

use LionMM\WebDriver\WebDriver;

class Foo {

    /** @var WebDriver  */
    private $webDriver;

    public function __construct(WebDriver $webDriver)
    {
        $this->webDriver = $webDriver;
    }
}

Next step - you must init Driver with method initDriver($parameters, $request_time_limit), (*20)

<?php

\WebDriver::initDriver(['lang' => 'en', 'no-flash' => true, 'proxy' => '220.155.15.133:8080'], 50000);

Instead, the parameter lang You can specify directly 'accept_languages' => 'ru-RU,ru,en,en-US,uk', (*21)

<?php

\WebDriver::initDriver(['accept_languages' => 'ru-RU,ru,en,en-US,uk', 'no-flash' => false, 'proxy' => '220.155.15.133:8080'], 50000, 'http:hub.site:5555/wd/hub');

By default flash is enabled and accept_languages set to ru-RU,ru,en,en-US,uk, (*22)

Go to url

Use method get($url) for load a new web page in the current browser window., (*23)

Operate vs page content

  • waitForElement($selector, $index, $timeout)
  • checkForElement($selector)
  • getAllElements($selector, $need, $timeout)
Frames
  • switchToFrame($element): Switch to the iframe by its id or name.
  • switchToDefaultContent(): Switch to the main document if the page contains iframes. Otherwise, switch to the first frame on the page.

Service functions

  • quit($wait = 0): run automatically in __destruct() method. Quits driver, closing every associated window. (hope this...)
  • deleteAllCookies(): Delete all the cookies that are currently visible.
  • getCookies(): Get all the cookies for the current domain.
  • addCookie($cookie): Add a specific cookie.
  • getCurrentURL(): Get a string representing the current URL that the browser is looking at
  • getTitle(): Get the title of the current page.
  • getPageSource(): Get the source of the last loaded page.
  • takeScreenshot($pathToSave): Take a screenshot of the current page. if parameter $pathToSave not set method return the screenshot contents in PNG format
  • executeScript($jsCode, $arguments, $async): Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. The result of evaluating the script will be returned.

The Versions

15/11 2017

dev-master

9999999-dev

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kirill Snovidov

laravel selenium webdriver firefox

15/11 2017

1.0.4

1.0.4.0

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kirill Snovidov

laravel selenium webdriver firefox

14/11 2017

1.0.3

1.0.3.0

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kirill Snovidov

laravel selenium webdriver firefox

06/12 2016

1.0.2

1.0.2.0

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kirill Snovidov

laravel selenium webdriver firefox

06/12 2016

dev-laravel5.1

dev-laravel5.1

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kirill Snovidov

laravel selenium webdriver firefox

06/12 2016

0.1.2

0.1.2.0

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kirill Snovidov

laravel selenium webdriver firefox

05/12 2016

1.0.1

1.0.1.0

Selenium Firefox web-driver interface for Laravel 5.1.* - 5.2.*

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kirill Snovidov

laravel selenium webdriver firefox

01/11 2016

v0.1.0

0.1.0.0

Selenium Firefox web-driver interface for Laravel 5.2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kirill Snovidov

laravel selenium webdriver firefox