Exemple #1
0
<?php

/*
 * This file is part of PHP Selenium Library.
 * (c) Alexandre Salomé <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../autoload.php';
$client = new Selenium\Client('localhost', 4444);
$browser = $client->getBrowser('http://alexandre-salome.fr');
$browserB = $client->getBrowser('http://alexandre-salome.fr');
// Starts the browser
$browser->start();
$browserB->start();
$browser->open('/')->click(Selenium\Locator::linkContaining('Blog'));
$browserB->open('/')->click(Selenium\Locator::linkContaining('Contact'));
$browser->waitForPageToLoad(10000);
$browserB->waitForPageToLoad(10000);
$titleA = $browser->getTitle();
$titleB = $browserB->getTitle();
// Stops the browser
$browser->stop();
$browserB->stop();
echo "Page A title: " . $titleA . "\n";
echo "Page B title: " . $titleB . "\n";
 protected function startBrowser()
 {
     // Set the Application URL containing the port of the test server
     Config::set('app.url', Config::get('app.url') . ':4443');
     App::setRequestForConsoleEnvironment();
     // This is a must
     if (!IntegrationTestCase::$loadedBrowser) {
         $client = new \Selenium\Client('localhost', 4444);
         $this->browser = $client->getBrowser('http://localhost:4443');
         $this->browser->start();
         $this->browser->windowMaximize();
         IntegrationTestCase::$loadedBrowser = $this->browser;
     } else {
         $this->browser = IntegrationTestCase::$loadedBrowser;
         $this->browser->open('/');
     }
 }
Exemple #3
0
<?php

/*
 * This file is part of PHP Selenium Library.
 * (c) Alexandre Salomé <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../vendor/autoload.php';
$client = new Selenium\Client('localhost', 4444);
$browser = $client->getBrowser('http://symfony-project.org');
// Starts the browser
$browser->start();
$browser->open('http://google.com')->waitForPageToLoad(10000)->open('http://symfony.com')->waitForPageToLoad(10000);
echo "Page title: " . $browser->getTitle() . "\n";
$browser->stop();
Exemple #4
0
<?php

/*
 * This file is part of PHP Selenium Library.
 * (c) Alexandre Salomé <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../vendor/autoload.php';
$client = new Selenium\Client('localhost', 4444);
$browser = $client->getBrowser('http://symfony.com');
// Starts the browser
$browser->start();
$browser->open('/')->waitForPageToLoad(10000);
echo $browser->getHtmlSource();
$browser->stop();
Exemple #5
0
 public static function setUpBeforeClass()
 {
     $client = new Selenium\Client('localhost', 4444);
     self::$browser = $client->getBrowser('http://alexandre-salome.fr');
     self::$browser->start();
 }