/** @test */ public function sampleTest() { $page = $this->driver->get('http://slovicka.my'); $this->assertContains('Slovicka', $page->getTitle()); $username = $this->driver->findElement(WebDriverBy::name('_username')); $username->sendKeys('*****@*****.**'); }
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); }
/** * @dataProvider userLocations */ public function testUserLocation($proxy, $expected) { $this->driver = $this->proxied($proxy); $this->driver->get($this->url); $search = $this->driver->findElement(WebDriverBy::id('user-city')); $this->assertContains($expected, $search->getText()); }
/** * {@inheritdoc}. Override to allow prepending the default host * * @author Ronan Chilvers <*****@*****.**> */ public function get($url) { if ($this->defaultHost && 'http' != substr($url, 0, 4)) { $url = $this->defaultHost . '/' . ltrim($url, '/'); } return parent::get($url); }
public function goToForm($link_text) { $this->webDriver->get($this->url); // Go Home first $link = $this->webDriver->findElement(WebDriverBy::linkText($link_text)); $link->click(); }
public function testSearch() { $this->webDriver->get($this->url); // find search field by its id $search = $this->webDriver->findElement(WebDriverBy::xpath('html/body/div[1]/div[1]/div/div[2]/form/label')); $search->click(); // typing into field $this->webDriver->getKeyboard()->sendKeys('php-webdriver'); // pressing "Enter" $this->webDriver->getKeyboard()->pressKey(WebDriverKeys::ENTER); $firstResult = $this->webDriver->findElement(WebDriverBy::cssSelector('li.repo-list-item:nth-child(1) > h3:nth-child(2) > a:nth-child(1)')); $firstResult->click(); // we expect that facebook/php-webdriver was the first result $this->assertContains("php-webdriver", $this->webDriver->getTitle()); $this->assertEquals('https://github.com/facebook/php-webdriver', $this->webDriver->getCurrentURL()); $this->assertElementNotFound(WebDriverBy::className('avatar')); }
public function testSearch() { $this->webDriver->get($this->url); // find search field by its id $search = $this->webDriver->findElement(WebDriverBy::id('js-command-bar-field')); $search->click(); // typing into field $this->webDriver->getKeyboard()->sendKeys('php-webdriver'); // pressing "Enter" $this->webDriver->getKeyboard()->pressKey(WebDriverKeys::ENTER); $firstResult = $this->webDriver->findElement(WebDriverBy::cssSelector('li.public:nth-child(1) > h3:nth-child(3) > a:nth-child(1) > em:nth-child(2)')); $firstResult->click(); // we expect that facebook/php-webdriver was the first result $this->assertContains("php-webdriver", $this->webDriver->getTitle()); $this->assertEquals('https://github.com/facebook/php-webdriver', $this->webDriver->getCurrentURL()); $this->assertElementNotFound(WebDriverBy::className('avatar')); // $this->waitForUserInput(); }
public function amOnPage($page) { // use absolute url if (strpos($page, 'http://') === 0 or strpos($page, 'https://') === 0) { $url = parse_url($page); if (isset($url['host']) and isset($url['scheme'])) { $host = $url['scheme'] . '://' . $url['host']; $this->_reconfigure(['url' => $host]); $page = substr($page, strlen($host)); $this->debugSection('Host', $host); } } $page = ltrim($page, '/'); $host = rtrim($this->config['url'], '/'); $this->webDriver->get($host . '/' . $page); }
/** * @param $url */ public function applicationGroupProfiles($url) { $this->webDriver->get($url . 'program/groups'); $this->webDriver->findElement(WebDriverBy::id('edit-button'))->click(); $this->webDriver->findElement(WebDriverBy::id('edit-field-group-name-und-0-value'))->sendKeys('Group 1'); $this->webDriver->findElement(WebDriverBy::id('edit-field-total-children-und-0-value'))->sendKeys('10'); $this->webDriver->findElement(WebDriverBy::id('edit-field-children-age-category-und-3'))->click(); $selectMSH = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::id('edit-field-group-schedule-und-2-starthours-hours'))); $selectMSH->selectByValue('6'); $selectMSM = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::id('edit-field-group-schedule-und-2-starthours-minutes'))); $selectMSM->selectByValue('00'); $selectMSA = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::id('edit-field-group-schedule-und-2-starthours-ampm'))); $selectMSA->selectByValue('am'); $selectMEH = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::id('edit-field-group-schedule-und-2-endhours-hours'))); $selectMEH->selectByValue('6'); $selectMEM = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::id('edit-field-group-schedule-und-2-endhours-minutes'))); $selectMEM->selectByValue('00'); $selectMEA = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::id('edit-field-group-schedule-und-2-endhours-ampm'))); $selectMEA->selectByValue('pm'); $this->webDriver->findElement(WebDriverBy::id('edit-submit'))->click(); }
public function amOnPage($page) { $host = rtrim($this->config['url'], '/'); $page = ltrim($page, '/'); $this->webDriver->get($host . '/' . $page); }
/** * Loads the relative url $url in web browser * @param string $url */ public static function get($url = "") { $url = self::$url . $url; self::$webDriver->get($url); }
public static function visit($path) { self::$webDriver->get(self::$root_url . $path); }
public function amOnPage($page) { $url = Uri::appendPath($this->config['url'], $page); $this->debugSection('GET', $url); $this->webDriver->get($url); }
public function testGitHubHome() { $this->webDriver->get($this->url); // checking that page title contains word 'GitHub' $this->assertContains('GitHub', $this->webDriver->getTitle()); }
/** * @param string $url */ public function open($url) { $this->_driver->get($url); }
public function amOnPage($page) { $build = parse_url($this->config['url']); $uriparts = parse_url($page); if ($build === false) { throw new \Codeception\Exception\TestRuntime("URL '{$this->config['url']}' is malformed"); } elseif ($uriparts === false) { throw new \Codeception\Exception\TestRuntime("URI '{$page}' is malformed"); } foreach ($uriparts as $part => $value) { if ($part === 'path' && !empty($build[$part])) { $build[$part] = rtrim($build[$part], '/') . '/' . ltrim($value, '/'); } else { $build[$part] = $value; } } $this->webDriver->get(\GuzzleHttp\Url::buildUrl($build)); }
public function testSimple() { $this->webDriver->get($this->url); // checking that page title contains word 'NetBeans' $this->assertContains('NetBeans', $this->webDriver->getTitle()); }
<?php // An example of using php-webdriver. require_once 'php_webdriver/__init__.php'; // start Firefox $host = 'http://172.31.17.231:8910/'; // this is the default $capabilities = array(WebDriverCapabilityType::BROWSER_NAME => 'phantomjs', WebDriverCapabilityType::ACCEPT_SSL_CERTS => true, WebDriverCapabilityType::JAVASCRIPT_ENABLED => true); $driver = new RemoteWebDriver($host, $capabilities); // navigate to 'http://docs.seleniumhq.org/' $session = $driver->get('http://booking.tigerair.com/Search.aspx'); // Search 'php' in the search box $from = $driver->findElement(WebDriverBy::cssSelector('select[name="ControlGroupSearchView_AvailabilitySearchInputSearchVieworiginStation1"] option[value="SUB"]')); $from->click(); $type = $driver->findElement(WebDriverBy::id('ControlGroupSearchView_AvailabilitySearchInputSearchView_OneWay')); $type->click(); $destination = $driver->findElement(WebDriverBy::cssSelector('select[name="ControlGroupSearchView_AvailabilitySearchInputSearchViewdestinationStation1"] option[value="CGK"]')); $destination->click(); $tgl = $driver->findElement(WebDriverBy::cssSelector('select[name="ControlGroupSearchView$AvailabilitySearchInputSearchView$DropDownListMarketDay1"] option[value="31"]')); $tgl->sendKeys('31'); $driver->findElement(WebDriverBy::id('ControlGroupSearchView_ButtonSubmit'))->click(); // wait at most 10 seconds until at least one result is shown $result = $driver->wait(10)->until(WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(WebDriverBy::className('altRowItem'))); $countresult = count($result); $arr = array(); for ($i = 0; $i < $countresult; $i++) { $arr[$i] = $result[$i]->getText(); } echo json_encode(array('jadwal' => $arr)); // close the Firefox $driver->quit();