Example #1
0
 public function __construct(WebDriver $driver)
 {
     $this->driver = $driver;
     $this->keyboard = $driver->getKeyboard();
     $this->mouse = $driver->getMouse();
     $this->action = new WebDriverCompositeAction();
 }
 public function screenshot(WebDriver $webDriver, $case = 'undefined')
 {
     $this->_createScreenShotDirIfNotExists();
     $screenName = date('d|m|y|H|i|s') . '|' . $case . '.png';
     file_put_contents($this->screenshotDir . DIRECTORY_SEPARATOR . $screenName, $webDriver->takeScreenshot());
     $buildNumber = $this->suiteSettings->getBuildNumber();
     $buildNumberPath = $buildNumber !== '' ? $buildNumber . DIRECTORY_SEPARATOR : '';
     $loggingDirectoryName = $this->suiteSettings->getLoggingDirectoryName();
     $loggingDirectoryNamePath = $loggingDirectoryName !== '' ? $loggingDirectoryName . DIRECTORY_SEPARATOR : '';
     return rtrim($buildNumberPath . $loggingDirectoryNamePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'screenshots' . DIRECTORY_SEPARATOR . $screenName;
 }
Example #3
0
 public function execute($name, $params)
 {
     try {
         return $this->driver->execute($name, $params);
     } catch (WebDriverException $exception) {
         $this->dispatchOnException($exception);
     }
 }
 /**
  * Applies the script timeout setting.
  *
  * @return $this|TestSuite Same instance for chained method calls.
  */
 private function _applyScriptTimeoutSetting()
 {
     $scriptTimeout = $this->suiteSettings->getScriptTimeout();
     if ((int) $scriptTimeout !== 0) {
         $this->output('Set script timeout setting to ' . $scriptTimeout . ' seconds.');
         $this->webDriver->manage()->timeouts()->setScriptTimeout($scriptTimeout);
     }
     return $this;
 }
Example #5
0
 /**
  * @param string $locator
  * @return WebDriverElement
  */
 protected function _findElement($locator)
 {
     return $this->_webDriver->findElement($this->_getLocator($locator));
 }
Example #6
0
 private function configureDriver()
 {
     $this->driver->manage()->timeouts()->implicitlyWait(15);
 }