/**
  * @test
  * @group caps
  * @group htmlunit
  */
 public function testHTMLUnitJS()
 {
     $driver = new PHPWebDriver_WebDriver();
     $session = $driver->session("htmlunitjs");
     // htmlunitjs
     $session->close();
 }
Example #2
0
 public static function setUpBeforeClass()
 {
     $driver = new PHPWebDriver_WebDriver();
     self::$session = $driver->session();
     // firefox
     self::$session->open("http://localhost:8000");
 }
Example #3
0
 public static function setUpBeforeClass()
 {
     $driver = new PHPWebDriver_WebDriver();
     self::$session = $driver->session();
     // firefox
     self::$session->open("http://ckeditor.com/demo");
 }
Example #4
0
 /**
  * @group profile
  */
 public function testProfileExists()
 {
     $driver = new PHPWebDriver_WebDriver();
     $profile = new PHPWebDriver_WebDriverFirefoxProfile(dirname(__FILE__) . '/support/profiles/red');
     // var_dump($profile);
     $session = $driver->session('firefox', array(), array(), $browser_profile = $profile);
     $session->close();
 }
Example #5
0
 public static function setUpBeforeClass()
 {
     $driver = new PHPWebDriver_WebDriver();
     self::$session = $driver->session();
     // firefox
     self::$session->open("http://localhost:8000/flexstore/flexstore.html");
     $e = self::$session->element("name", "flexstore");
     self::$fp = new PHPWebDriver_WebDriver_Support_FlashFlex_FlexPilot(self::$session, $e);
     self::$fp->wait_for_flex_ready();
 }
Example #6
0
 public function setUp()
 {
     $driver = new \PHPWebDriver_WebDriver();
     self::$client = new \PHPBrowserMobProxy_Client("localhost:8080");
     $additional_capabilities = array();
     $proxy = new \PHPWebDriver_WebDriverProxy();
     $proxy->httpProxy = self::$client->url;
     $proxy->add_to_capabilities($additional_capabilities);
     self::$session = $driver->session('firefox', $additional_capabilities);
     self::$client->blacklist('.*\\/favicon\\.ico/.*', 306);
     self::$client->blacklist('.*\\.facebook\\.net/.*', 306);
     self::$client->blacklist('.*\\.twitter\\.com/.*', 306);
     self::$client->blacklist('.*\\.github\\.com/.*', 306);
 }
Example #7
0
 function __construct($executor = null)
 {
     if (!is_null($executor)) {
         parent::__construct($executor);
     } else {
         parent::__construct();
     }
 }
Example #8
0
<?php

require_once 'PHPWebDriver/WebDriver.php';
$wd_host = 'http://*****:*****@ondemand.saucelabs.com:80/wd/hub';
//$wd_host = 'http://localhost';
$web_driver = new PHPWebDriver_WebDriver($wd_host);
$session = $web_driver->session('firefox');
$session->open('http://saucelabs.com/test/guinea-pig');
if ($session->title() == "I am a page title - Sauce Labs") {
    echo "Title is 'I am a page title - Sauce Labs': OK.\n";
}
$session->element("id", "i am a link")->click();
if ($session->title() == "I am another page title - Sauce Labs") {
    echo "Followed link: OK.\n";
}
$session->back();
if ($session->title() == "I am a page title - Sauce Labs") {
    echo "Back to main page: OK.\n";
}
$session->element("id", "i_am_a_textbox")->sendKeys("Something for a textbox");
if (!$session->element("id", "unchecked_checkbox")->selected()) {
    $session->element("id", "unchecked_checkbox")->click();
}
if ($session->element("id", "unchecked_checkbox")->selected()) {
    echo "Selection: OK.\n";
}
if ($session->element("id", "checked_checkbox")->selected()) {
    $session->element("id", "checked_checkbox")->click();
}
if (!$session->element("id", "checked_checkbox")->selected()) {
    echo "Unselecting: OK.\n";
 public function __construct($executor = "")
 {
     parent::__construct($executor);
 }
Example #10
0
 /**
  *
  */
 function doTesting()
 {
     $dirHandle = opendir(Ruth::getREAL_PATH() . "/" . $this->testDir);
     set_time_limit(0);
     $wd_host = 'http://localhost:4444/wd/hub';
     $this->message("Initialize testing on " . $wd_host . " for " . $this->testServer);
     $this->message("Test Path: " . Ruth::getREAL_PATH() . "/" . $this->testDir);
     $this->message("Loading test methods into class");
     //include all the files , append all the functions / methods
     $fileArray = [];
     $i = 0;
     while (false !== ($entry = readdir($dirHandle))) {
         if ($entry != "." && $entry != ".." && stripos($entry, ".php")) {
             $fileArray[$i] = Ruth::getREAL_PATH() . "/" . $this->testDir . "/" . $entry;
             $i++;
         }
     }
     asort($fileArray);
     $functions = get_defined_functions();
     $arrayFunctions = array_keys($functions['user']);
     $last_index = array_pop($arrayFunctions);
     // Include your file here.
     foreach ($fileArray as $fid => $fileName) {
         require_once $fileName;
     }
     $functions = get_defined_functions();
     $new_functions = array_slice($functions['user'], $last_index);
     unset($new_functions[0]);
     foreach ($new_functions as $fid => $functionName) {
         $arguments = $this->get_func_argNames($functionName);
         $temp = "";
         foreach ($arguments as $aid => $argument) {
             $temp[] = '$' . $argument;
         }
         if (!empty($temp)) {
             $arguments = implode($temp, ',');
         } else {
             $arguments = "";
         }
         eval('$this->methods["' . $functionName . '"] = \\Closure::bind(function(' . $arguments . ') { ' . $functionName . '(' . $arguments . '); }, $this, get_class());');
     }
     $this->message("Test Functions added: " . print_r(implode($new_functions, ","), 1));
     $web_driver = new PHPWebDriver_WebDriver($wd_host);
     if (!empty(Ruth::getSESSION("tessaSession"))) {
         $this->session = unserialize(Ruth::getSESSION("tessaSession"));
     } else {
         $browser_profile = new PHPWebDriver_WebDriverFirefoxProfile(dirname(dirname(__FILE__)) . "/selenium/firefox-profile");
         $this->session = $web_driver->session($this->browser, array(), array(), $browser_profile);
         Ruth::setSESSION("tessaSession", serialize($this->session));
     }
     //this is the default port for testing
     try {
         $this->session->open($this->testServer);
     } catch (Exception $e) {
         $browser_profile = new PHPWebDriver_WebDriverFirefoxProfile(dirname(dirname(__FILE__)) . "/selenium/firefox-profile");
         $this->session = $web_driver->session($this->browser, array(), array(), $browser_profile);
         Ruth::setSESSION("tessaSession", serialize($this->session));
         $this->session->open($this->testServer);
     }
     $this->session->window()->maximize();
     //go through each test, load then up and run them
     echo "<pre>";
     echo "<h1>Running Tests!</h1>";
     $this->runTests();
     echo "</pre>";
 }
Example #11
0
 public static function setUpBeforeClass()
 {
     $driver = new PHPWebDriver_WebDriver();
     self::$session = $driver->session();
     // firefox
 }
Example #12
0
 /**
  * Create a session and connect to it.
  */
 public function connect()
 {
     $this->__session = $this->__webDriver->__session('firefox');
 }
Example #13
0
 public function setUp()
 {
     $driver = new \PHPWebDriver_WebDriver();
     self::$session = $driver->session();
 }