예제 #1
0
 public function quit()
 {
     try {
         $this->driver->quit();
     } catch (UnknownServerException $e) {
     }
 }
예제 #2
0
 /**
  * This method is called after the last case in the test has been run.
  * We can safely terminate the webdriver connection here.
  *
  * @access public
  */
 public static function tearDownAfterClass()
 {
     if (self::$my_webdriver !== null) {
         self::$my_webdriver->quit();
         self::$my_webdriver = null;
     }
 }
예제 #3
0
 /**
  * Set user agent
  */
 public function testSetUserAgent()
 {
     $useragent = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16';
     // setup
     $capabilities = DesiredCapabilities::firefox();
     /** @var FirefoxProfile $profile */
     $profile = $capabilities->getCapability(FirefoxDriver::PROFILE);
     $profile->setPreference('general.useragent.override', $useragent);
     $this->webDriver = RemoteWebDriver::create('http://' . self::HOST . '/wd/hub', $capabilities);
     // test
     $this->webDriver->get('http://demo.mobiledetect.net/');
     $elements = $this->webDriver->findElements(WebDriverBy::tagName('h1'));
     static::assertEquals(3, count($elements));
     $elementContainingQuestion = $elements[1];
     static::assertEquals('Is your device really a phone?', $elementContainingQuestion->getText());
     $this->webDriver->quit();
 }
예제 #4
0
 public function _afterSuite()
 {
     // this is just to make sure webDriver is cleared after suite
     if (isset($this->webDriver)) {
         $this->webDriver->quit();
         unset($this->webDriver);
     }
 }
예제 #5
0
 /**
  * This method is invoked after a test method
  */
 public function tearDown()
 {
     $this->webDriver->quit();
 }
 public function tearDown()
 {
     if ($this->webDriver instanceof RemoteWebDriver) {
         $this->webDriver->quit();
     }
 }
예제 #7
0
 protected function cleanWebDriver()
 {
     foreach ($this->sessions as $session) {
         $this->_loadSession($session);
         try {
             $this->webDriver->quit();
         } catch (UnknownServerException $e) {
             // Session already closed so nothing to do
         }
         unset($this->webDriver);
     }
     $this->sessions = [];
 }
예제 #8
0
 protected function tearDown()
 {
     if ($this->driver) {
         $this->driver->quit();
     }
 }