protected function proxied($proxy)
 {
     $capabilities = DesiredCapabilities::phantomjs();
     $capabilities->setCapability(WebDriverCapabilityType::PROXY, ['proxyType' => 'MANUAL', 'httpProxy' => $proxy, 'ftpProxy' => $proxy, 'sslProxy' => $proxy, 'noProxy' => null]);
     $capabilities->setCapability('phantomjs.cli.args', ['--proxy-auth=' . getenv('WONDERPROXY_USER') . ':' . getenv('WONDERPROXY_PASS')]);
     return RemoteWebDriver::create($this->selenium, $capabilities);
 }
Exemplo n.º 2
0
 function __construct()
 {
     $host = 'http://localhost:4444/wd/hub';
     // this is the default
     $capabilities = DesiredCapabilities::firefox();
     $this->driver = RemoteWebDriver::create($host, $capabilities);
 }
 public function setUp()
 {
     $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'chrome');
     $this->webDriver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities);
     $dev_url = 'http://fvdmug-automation.local:8083/';
     $this->webDriver->get($dev_url);
 }
Exemplo n.º 4
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     if (version_compare(PHP_VERSION, '5.3.19', '<')) {
         self::markTestSkipped('UI test case requires at least PHP 5.3.19.');
     } else {
         if (!class_exists('\\RemoteWebDriver')) {
             self::markTestSkipped('Could not find RemoteWebDriver class. ' . 'Run "php ../composer.phar install" from the tests folder.');
         }
     }
     self::$config = phpbb_test_case_helpers::get_test_config();
     self::$root_url = self::$config['phpbb_functional_url'];
     // Important: this is used both for installation and by
     // test cases for querying the tables.
     // Therefore table prefix must be set before a board is
     // installed, and also before each test case is run.
     self::$config['table_prefix'] = 'phpbb_';
     if (!isset(self::$config['phpbb_functional_url'])) {
         self::markTestSkipped('phpbb_functional_url was not set in test_config and wasn\'t set as PHPBB_FUNCTIONAL_URL environment variable either.');
     }
     if (!self::$webDriver) {
         try {
             $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'firefox');
             self::$webDriver = RemoteWebDriver::create(self::$host . ':' . self::$port, $capabilities);
         } catch (WebDriverCurlException $e) {
             self::markTestSkipped('PhantomJS webserver is not running.');
         }
     }
     if (!self::$already_installed) {
         self::install_board();
         self::$already_installed = true;
     }
 }
Exemplo n.º 5
0
 protected function setUp()
 {
     $host = 'http://127.0.0.1:4444/wd/hub';
     // this is the default
     $capabilities = array(WebDriverCapabilityType::BROWSER_NAME => 'chrome');
     $this->driver = RemoteWebDriver::create($host, $capabilities);
 }
 /** @Given /^I am on "([^"]*)"$/ */
 public function iAmOnSite($url)
 {
     print "HHHHHHH >" . $this->tunnel;
     $desiredCap = array('browser' => $this->BROWSER_NAME, 'browser_version' => $this->BROWSER_VERSION, 'os' => $this->OS, 'os_version' => $this->OS_VERSION, 'browserstack.tunnel' => $this->tunnel);
     $this->webDriver = RemoteWebDriver::create("http://" . $this->USERNAME . ":" . $this->BROWSERSTACK_KEY . "@hub.browserstack.com/wd/hub", $desiredCap);
     $this->webDriver->get($url);
 }
Exemplo n.º 7
0
 protected function setUp()
 {
     parent::setUp();
     $capabilities = DesiredCapabilities::firefox();
     $host = 'http://localhost:4444/wd/hub';
     $this->driver = RemoteWebDriver::create($host, $capabilities, 45000);
 }
Exemplo n.º 8
0
 public function _initialize()
 {
     $this->wd_host = sprintf('http://%s:%s/wd/hub', $this->config['host'], $this->config['port']);
     $this->capabilities = $this->config['capabilities'];
     $this->capabilities[\WebDriverCapabilityType::BROWSER_NAME] = $this->config['browser'];
     $this->webDriver = \RemoteWebDriver::create($this->wd_host, $this->capabilities);
     $this->webDriver->manage()->timeouts()->implicitlyWait($this->config['wait']);
 }
 protected function setUp()
 {
     Phpfox::getService('unittest.test.socialad')->truncateAllRelatedTables();
     $host = 'http://localhost:4444/wd/hub';
     // this is the default
     $capabilities = array(WebDriverCapabilityType::BROWSER_NAME => 'firefox');
     $this->driver = RemoteWebDriver::create($host, $capabilities);
 }
Exemplo n.º 10
0
 private static function createUserAgentSpecifiedFirefoxDriver($ua)
 {
     $profile = new \FireFoxProfile();
     $profile->setPreference('general.useragent.override', $ua);
     $caps = \DesiredCapabilities::firefox();
     $caps->setCapability(\FirefoxDriver::PROFILE, $profile);
     return \RemoteWebDriver::create(static::HUB_URL, $caps);
 }
Exemplo n.º 11
0
 /**
  * Создаем connect
  */
 private function set_up()
 {
     $host = 'http://localhost:4444/wd/hub';
     // this is the default
     $capabilities = DesiredCapabilities::firefox();
     $this->web_driver = RemoteWebDriver::create($host, $capabilities, 5000);
     // $this->web_driver->manage()->timeouts()->pageLoadTimeout(10);
     $this->web_driver->get(self::URL_BASE);
 }
 public function testFacebook()
 {
     $url = "http://" . self::$user_id . ":" . self::$security_key . "@hub.browserstack.com/wd/hub";
     $caps = array("browser" => "IE", "browser_version" => "9.0", "os" => "Windows", "os_version" => "7", "browserstack.debug" => "true");
     $web_driver = RemoteWebDriver::create($url, $caps);
     $web_driver->get("http://www.facebook.com");
     print $web_driver->getTitle();
     $web_driver->quit();
 }
Exemplo n.º 13
0
 static function start($browser)
 {
     $seleniumHost = "http://" . Config::get("SELENIUM_HOST") . ":" . Config::get("SELENIUM_PORT") . "/wd/hub";
     switch ($browser) {
         case "chrome":
             putenv("webdriver.chrome.driver=" . Config::get("CHROME_WEBDRIVER_PATH"));
             $capabilities = \DesiredCapabilities::chrome();
             $options = new \ChromeOptions();
             $options->addArguments(array("--start-maximized"));
             $options->addArguments(array("applicationCacheEnabled=1"));
             $capabilities->setCapability(\ChromeOptions::CAPABILITY, $options);
             break;
         case "ie":
             $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => "Internet Explorer");
             break;
         case "firefox_with_firebug":
             $profile = new \FirefoxProfile();
             $profile->setPreference('extensions.firebug.currentVersion', Config::get("FIREBUG_VERSION"));
             $profile->setPreference("extensions.firebug.allPagesActivation", "on");
             $profile->setPreference("extensions.firebug.defaultPanelName", "net");
             $profile->setPreference("extensions.firebug.net.enableSites", true);
             // Set default NetExport preferences
             $profile->setPreference("extensions.firebug.netexport.alwaysEnableAutoExport", true);
             $profile->setPreference("extensions.firebug.netexport.defaultLogDir", Config::get("LOG_PATH"));
             $profile->setPreference("extensions.firebug.netexport.showPreview", false);
             $profile->setPreference("extensions.firebug.netexport.autoExportToFile", true);
             $profile->setPreference("extensions.firebug.netexport.autoExportToServer", false);
             $profile->setPreference("extensions.firebug.netexport.includeResponseBodies", true);
             //$profile->setPreference("extensions.firebug.netexport.pageLoadedTimeout", 5000);
             $profile->addExtension(Config::get("FIREBUG_XPI_PATH"))->addExtension(Config::get("NET_EXPORT_XPI_PATH"));
             $capabilities = \DesiredCapabilities::firefox();
             $capabilities->setCapability(\FirefoxDriver::PROFILE, $profile);
             break;
         case "chrome_default_profile":
             putenv("webdriver.chrome.driver=" . Config::get("CHROME_WEBDRIVER_PATH"));
             $capabilities = \DesiredCapabilities::chrome();
             $options = new \ChromeOptions();
             $options->addArguments(array("start-maximized"));
             $options->addArguments(array("applicationCacheEnabled=1"));
             $options->addArguments(array("user-data-dir=" . Config::get("BROWSER_DATA_DIR")));
             $capabilities->setCapability(\ChromeOptions::CAPABILITY, $options);
             break;
         case "firefox_default_profile":
             // TODO: not working correctly. Need fix
             putenv("webdriver.firefox.profile=default");
             $profile = new \FirefoxProfile();
             $profile->setPreference("webdriver.firefox.profile", "default");
             //$profile->setPreference("webdriver.load.strategy", "unstable");
             $capabilities = \DesiredCapabilities::firefox();
             $capabilities->setCapability(\FirefoxDriver::PROFILE, $profile);
             break;
         default:
             // firefox by default
             $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => "firefox");
     }
     self::$driver = \RemoteWebDriver::create($seleniumHost, $capabilities, 90000, 90000);
 }
 protected function setUp() {
   $this->driver = RemoteWebDriver::create(
     'http://localhost:4444/wd/hub',
     array(
       WebDriverCapabilityType::BROWSER_NAME
         => WebDriverBrowserType::HTMLUNIT,
     )
   );
 }
Exemplo n.º 15
0
 public function test_header()
 {
     putenv('foo=bar');
     $w = RemoteWebDriver::create('http://localhost:4444/wd/hub', [WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::HTMLUNIT]);
     $url = 'http://localhost/mylibrary-yii2/backend/web/site/index';
     $w->get($url);
     echo $w->getPageSource();
     //$w->takeScreenshot('1.jpg');
     $w->quit();
 }
Exemplo n.º 16
0
 public static function setUpBeforeClass()
 {
     InterfaceTest::$process = proc_open("java \"-Dwebdriver.chrome.driver=res/chromedriver.exe\" -jar res/selenium-server-standalone-2.48.2.jar", [["pipe", "r"], ["pipe", "w"]], $pipe);
     if (InterfaceTest::$process === false) {
         throw new Exception("Failed to start selenium server");
     }
     //loads a verified user 'testuser' with blid '4833' and email 'email@email.com` and password 'asdf'
     TestManager::loadBasicDummyData();
     InterfaceTest::$webDriver = RemoteWebDriver::create("http://localhost:4444/wd/hub", DesiredCapabilities::chrome());
 }
Exemplo n.º 17
0
 public function setUp()
 {
     $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'firefox');
     $this->webDriver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities);
     $dev_url = 'http://naeyc.local:8083/';
     $qa_url = 'http://qa.naeyc.drupal.breaktech.org/';
     $qa2_url = 'http://192.168.77.61/';
     $this->url = $dev_url;
     $this->webDriver->get($this->url);
     date_default_timezone_set('America/Chicago');
 }
Exemplo n.º 18
0
 /**
  * Initializes webdriver.
  *
  * @since 1.0.0
  *
  * @access public
  */
 public function _initialize()
 {
     $this->wd_host = sprintf('http://%s:%s@hub.browserstack.com/wd/hub', $this->config['username'], $this->config['access_key']);
     $this->capabilities = $this->config['capabilities'];
     $this->capabilities[\WebDriverCapabilityType::BROWSER_NAME] = $this->config['browser'];
     if (!empty($this->config['version'])) {
         $this->capabilities[\WebDriverCapabilityType::VERSION] = $this->config['version'];
     }
     $this->webDriver = \RemoteWebDriver::create($this->wd_host, $this->capabilities);
     $this->webDriver->manage()->timeouts()->implicitlyWait($this->config['wait']);
     $this->initialWindowSize();
 }
Exemplo n.º 19
0
 private function _initDriver()
 {
     $host = 'http://' . $this->_seleniumHost() . ':' . $this->_seleniumPort() . '/wd/hub';
     $driverName = $this->_seleniumDriver();
     if ($driverName === 'firefox') {
         $capabilities = \DesiredCapabilities::firefox();
     } elseif ($driverName === 'chrome') {
         $capabilities = \DesiredCapabilities::chrome();
     } else {
         throw new Exception("Invalid driver name {$driverName}");
     }
     $this->_driver = \RemoteWebDriver::create($host, $capabilities, $this->_seleniumTimeout());
 }
Exemplo n.º 20
0
 function testLogCreatesNewFileOnFirstMessage()
 {
     echo 'This is a test with simple test';
     $web_driver = RemoteWebDriver::create("http://<username>:<access_key>@hub.browserstack.com/wd/hub", array("platform" => "WINDOWS"));
     $web_driver->get("http://www.google.com/ncr");
     $this->assertEquals("Google", $web_driver->getTitle());
     $element = $web_driver->findElement(WebDriverBy::name("q"));
     if ($element) {
         $element->sendKeys("Browserstack");
         $element->submit();
         //$this->assertEquals(0, count($stack));
     }
     $web_driver->quit();
 }
 public function setUp()
 {
     $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'firefox');
     $this->webDriver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities);
     $this->app = self::createApplication();
     //log user in
     $this->webDriver->get($this->baseUrl);
     $usernameField = $this->webDriver->findElement(WebDriverBy::name("username"));
     $usernameField->sendKeys("superuser");
     $passwordField = $this->webDriver->findElement(WebDriverBy::name("password"));
     $passwordField->sendKeys("mala");
     $loginBtn = $this->webDriver->findElement(WebDriverBy::id("login-btn"));
     $loginBtn->click();
     $this->webDriver->manage()->timeouts()->implicitlyWait(1000);
 }
 public static function setUpBeforeClass()
 {
     global $rssObjectName;
     self::$rssObjectName = $rssObjectName;
     $host = 'http://localhost:4444/wd/hub';
     // this is the default
     $capabilities = DesiredCapabilities::firefox();
     self::$webDriver = RemoteWebDriver::create($host, $capabilities, 5000);
     self::$webDriver->manage()->timeouts()->implicitlyWait(3);
     // implicitly wait time => 3 sec.
     self::$webDriver->manage()->window()->maximize();
     // maxize browser window
     self::$webDriver->get(self::$url);
     // go to RoomSharing System
     self::$helper = new ilRoomSharingAcceptanceSeleniumHelper(self::$webDriver, self::$rssObjectName);
 }
 public static function getDriver($browser)
 {
     if (array_key_exists('browser', $browser)) {
         $browserName = $browser['browser'];
     } elseif (array_key_exists('name', $browser)) {
         $browserName = $browser['name'];
     } else {
         $browserName = 'firefox';
     }
     /** @var DesiredCapabilities $capabilities */
     $capabilities = call_user_func(array('DesiredCapabilities', $browserName));
     if (array_key_exists('version', $browser)) {
         $capabilities->setVersion($browser['version']);
     }
     if (array_key_exists('platform', $browser)) {
         $capabilities->setPlatform($browser['platform']);
     }
     $baseHost = array_key_exists('baseHost', $browser) ? $browser['baseHost'] : 'localhost';
     if (array_key_exists('sauce', $browser)) {
         $host = 'http://' . $browser['sauce'] . '@ondemand.saucelabs.com:80/wd/hub';
         if (getenv('TRAVIS_JOB_NUMBER')) {
             // silly hack to set the tunnel id for travis
             // TODO: make this more generic, not dependant on travis
             $capabilities->setCapability('tunnel-identifier', getenv('TRAVIS_JOB_NUMBER'));
         }
     } elseif (array_key_exists('host', $browser)) {
         $host = $browser['host'];
     } elseif ($browserName == 'chrome') {
         $host = 'http://' . $baseHost . ':9515';
     } else {
         $host = 'http://' . $baseHost . ':4444/wd/hub';
     }
     $timeout = array_key_exists('timeout', $browser) ? $browser['timeout'] : 30000;
     $driver = RemoteWebDriver::create($host, $capabilities, $timeout);
     if (array_key_exists('sauce', $browser)) {
         echo "\nhttps://saucelabs.com/tests/" . $driver->getSessionID() . "\n";
     }
     $driver->manage()->window()->setSize(new \WebDriverDimension(1024, 768));
     return $driver;
 }
Exemplo n.º 24
0
 public function __construct($verbose = "false", $host = "localhost", $port = "4444")
 {
     // Set verbose mode - for development testing
     $this->verbose = $verbose;
     // Get the configuration from Configurator
     // If configuaration has a problem stop processing
     $this->configarray = $this->getConfig();
     if ($this->configarray === false) {
         return "Problem with config. Check and restart.";
     }
     $this->steps = isset($this->configarray['steps']) ? $this->configarray['steps'] : null;
     // Require steps now - everything will be performed thru steps
     if ($this->steps == NULL) {
         return "Nothing to do. Check your configuration. Steps are required.";
     }
     $this->elements = isset($this->configarray['elements']) ? $this->configarray['elements'] : null;
     if (isset($this->configarray['site'])) {
         $this->site = $this->configarray['site'];
     } else {
         return "Missing site. Check your config XML and correct.";
     }
     $dhost = 'http://' . $host . ':' . $port . '/wd/hub';
     $capabilities = DesiredCapabilities::firefox();
     // Build Firefox Profile
     // Additional Options available in Config
     $this->profile = new FirefoxProfile();
     if (isset($this->configarray['firefoxprofile'])) {
         $firefox_config = $this->configarray['firefoxprofile'];
         $this->generateProfile($firefox_config);
     }
     $this->logverbose("Firefox Profile", print_r($this->profile, true));
     $capabilities->setCapability(FirefoxDriver::PROFILE, $this->profile);
     try {
         $this->driver = RemoteWebDriver::create($dhost, $capabilities, 5000);
     } catch (Exception $e) {
         die("Please start WebDriver\n");
     }
     // Start by going to site specified in config
     $this->driver->get($this->site);
 }
 protected function setUp()
 {
     $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'firefox');
     $this->webDriver = RemoteWebDriver::create('http://127.0.0.1:4444/wd/hub', $capabilities);
 }
Exemplo n.º 26
0
<?php

set_error_handler(function ($errno, $errstr, $errfile, $errline) {
    throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
});
require __DIR__ . '/../vendor/autoload.php';
$driver = RemoteWebDriver::create('127.0.0.1:4444/wd/hub', DesiredCapabilities::phantomjs());
$driver->manage()->window()->setSize(new WebDriverDimension(1024, 1024));
$driver->manage()->timeouts()->implicitlyWait(8);
$driver->get('http://www.sbb.ch/geschaeftsreisen.html');
$driver->findElement(WebDriverBy::id('btUser'))->sendKeys('stc-cpedersoli');
Exemplo n.º 27
0
 public function _initializeSession()
 {
     $this->webDriver = \RemoteWebDriver::create($this->wd_host, $this->capabilities);
     $this->webDriver->manage()->timeouts()->implicitlyWait($this->config['wait']);
 }
Exemplo n.º 28
0
<?php

// An example of using php-webdriver.
require_once 'lib/__init__.php';
// start Firefox with 5 second timeout
$host = 'http://localhost:4444/wd/hub';
// this is the default
$capabilities = array(WebDriverCapabilityType::BROWSER_NAME => 'firefox');
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
// navigate to 'http://docs.seleniumhq.org/'
$driver->get('http://docs.seleniumhq.org/');
// adding cookie
$driver->manage()->deleteAllCookies();
$driver->manage()->addCookie(array('name' => 'cookie_name', 'value' => 'cookie_value'));
$cookies = $driver->manage()->getCookies();
print_r($cookies);
// click the link 'About'
$link = $driver->findElement(WebDriverBy::id('menu_about'));
$link->click();
// print the title of the current page
echo "The title is " . $driver->getTitle() . "'\n";
// print the title of the current page
echo "The current URI is " . $driver->getCurrentURL() . "'\n";
// Search 'php' in the search box
$input = $driver->findElement(WebDriverBy::id('q'));
$input->sendKeys('php')->submit();
// wait at most 10 seconds until at least one result is shown
$driver->wait(10)->until(WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(WebDriverBy::className('gsc-result')));
// close the Firefox
$driver->quit();
Exemplo n.º 29
0
 public static function setUpBeforeClass()
 {
     $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'chrome', \WebDriverCapabilityType::VERSION => '45.0');
     self::$webDriver = \RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities);
 }
Exemplo n.º 30
0
    $driver->get(wordpress('/wp-login.php'));
    $driver->findElement(WebDriverBy::tagName('body'))->click();
    $driver->findElement(WebDriverBy::name('log'))->clear()->click()->sendKeys('admin');
    $driver->findElement(WebDriverBy::name('pwd'))->sendKeys('admin');
    $driver->findElement(WebDriverBy::tagName('form'))->submit();
    if ($driver->findElement(WebDriverBy::tagName('h2'))->getText() == 'Dashboard') {
        print "Successfully logged into WordPress.\n";
    } else {
        var_dump($driver->getPageSource());
        throw new UnexpectedValueException('Login failed.');
    }
}
function activate_plugin($driver)
{
    $driver->get(wordpress('/wp-admin/plugins.php'));
    $activate_links = $driver->findElements(WebDriverBy::xpath('//a[starts-with(@href, "plugins.php?action=activate&plugin=tinypng-image-compression")]'));
    $deactivate_links = $driver->findElements(WebDriverBy::xpath('//a[starts-with(@href, "plugins.php?action=deactivate&plugin=tinypng-image-compression")]'));
    if (count($activate_links) > 0) {
        $activate_links[0]->click();
    } elseif (count($deactivate_links) > 0) {
        print "Plugin already activated.\n";
    } else {
        var_dump($driver->getPageSource());
        throw new UnexpectedValueException('Activating plugin failed.');
    }
}
register_shutdown_function('restore_wordpress');
$global_phantom_host = 'http://127.0.0.1:4444/wd/hub';
$global_driver = RemoteWebDriver::create($global_phantom_host, DesiredCapabilities::firefox());
$global_session_id = $global_driver->getSessionID();
configure_wordpress_for_testing($global_driver);