本文整理汇总了PHP中WebDriverBy::tagName方法的典型用法代码示例。如果您正苦于以下问题:PHP WebDriverBy::tagName方法的具体用法?PHP WebDriverBy::tagName怎么用?PHP WebDriverBy::tagName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebDriverBy
的用法示例。
在下文中一共展示了WebDriverBy::tagName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login($user, $pass)
{
$this->driver->get($this->url);
$this->driver->findElement(WebDriverBy::id("usuariologin"))->sendKeys("teste");
$this->driver->findElement(WebDriverBy::id("usuariosenha"))->sendKeys("123");
$this->driver->findElement(WebDriverBy::tagName("button"))->click();
$this->assertEquals("Administração QuickLoja", $this->driver->getTitle());
return $this->driver;
}
示例2: testShouldPersistSizes
public function testShouldPersistSizes()
{
$element = self::$driver->findElement(WebDriverBy::id('tinypng_sizes_medium'));
$element->click();
self::$driver->findElement(WebDriverBy::tagName('form'))->submit();
$elements = self::$driver->findElements(WebDriverBy::xpath('//input[@type="checkbox" and starts-with(@name, "tinypng_sizes") and @checked="checked"]'));
$size_ids = array_map('elementName', $elements);
$this->assertContains('tinypng_sizes[thumbnail]', $size_ids);
$this->assertNotContains('tinypng_sizes[medium]', $size_ids);
$this->assertContains('tinypng_sizes[large]', $size_ids);
}
示例3: validarPaginaIcialValidarMensagemAlerta
public function validarPaginaIcialValidarMensagemAlerta()
{
$this->driver->get($this->url);
$this->driver->findElement(WebDriverBy::id("novopedido"))->click();
$this->driver->findElement(WebDriverBy::id("id"))->sendKeys("TESTE");
$combo = $this->driver->findElement(WebDriverBy::id("produto"));
$combo = new WebDriverSelect($combo);
$combo->selectByValue("Firefox");
$this->driver->findElement(WebDriverBy::id("estoque"))->sendKeys(100);
$this->driver->findElement(WebDriverBy::id("valor"))->sendKeys(19.9);
$this->driver->findElement(WebDriverBy::cssSelector("label[for='quantidade5']"))->click();
$this->driver->findElement(WebDriverBy::tagName("button"))->click();
$mensagem = $this->driver->switchTo()->alert()->getText();
$this->driver->switchTo()->alert()->dismiss();
$this->assertEquals("Sucesso", $mensagem);
}
示例4: testNavBar
public function testNavBar()
{
$this->driver->get('http://localhost:80/index.php');
$menu = $this->driver->findElement(WebDriverBy::id('navcontent'))->findElement(WebDriverBy::tagName('ul'));
//assert that we are not in mobile mode when maximized
$this->driver->manage()->window()->maximize();
$this->assertFalse(strpos($menu->getAttribute("class"), "mobilemenu"));
//assert that we are in mobile mode with a small window
$this->driver->manage()->window()->setSize(new WebDriverDimension(450, 600));
$this->driver->wait(2, 250)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::className("mobilemenu")));
$this->assertContains("mobilemenu", $menu->getAttribute("class"));
//assert that reverting back clears mobile mode
$this->driver->manage()->window()->maximize();
//$this->driver->wait(2, 250)->until(WebDriverExpectedCondition::not(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::className("mobilemenu"))));
sleep(1);
$this->assertFalse(strpos($menu->getAttribute("class"), "mobilemenu"));
}
示例5: enable_compression_sizes
protected function enable_compression_sizes($sizes)
{
self::$driver->get(wordpress('/wp-admin/options-media.php'));
$elements = self::$driver->findElements(WebDriverBy::xpath('//input[starts-with(@id, "tinypng_sizes_")]'));
foreach ($elements as $element) {
$size = str_replace('tinypng_sizes_', '', $element->getAttribute('id'));
if (in_array($size, $sizes)) {
if (!$element->getAttribute('checked')) {
$element->click();
}
} else {
if ($element->getAttribute('checked')) {
$element->click();
}
}
}
self::$driver->findElement(WebDriverBy::tagName('form'))->submit();
}
示例6: testGetByTagName
public function testGetByTagName()
{
$this->driver->get($this->getTestPath('index.html'));
self::assertEquals('Test Value', $this->driver->findElement(WebDriverBy::tagName('input'))->getAttribute('value'));
}
示例7: getOptions
/**
* @return array All options belonging to this select tag.
*/
public function getOptions()
{
return $this->element->findElements(WebDriverBy::tagName('option'));
}
示例8: login
function login($driver)
{
$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.');
}
}
示例9: testStatusPresenseFail
public function testStatusPresenseFail()
{
$this->set_api_key('INVALID123');
$elements = self::$driver->findElement(WebDriverBy::id('tiny-compress-status'))->findElements(WebDriverBy::tagName('p'));
$statuses = array_map('innerText', $elements);
$this->assertContains('API connection unsuccessful', $statuses);
}
示例10: waitForTag
/**
* Wait for element whose tag name matches the search value.
*
* @param string $tagName
* @param bool $mustBeVisible Pass true to check if element is also visible. False only checks presence in DOM.
* @return \RemoteWebElement
*/
public function waitForTag($tagName, $mustBeVisible = false)
{
return $this->waitForElement(\WebDriverBy::tagName($tagName), $mustBeVisible);
}
示例11: testShouldShowSavings
public function testShouldShowSavings()
{
reset_webservice();
$this->set_api_key('PNG123');
$this->upload_image(dirname(__FILE__) . '/../fixtures/input-example.png');
self::$driver->get(wordpress('/wp-admin/options-media.php'));
self::$driver->wait(2)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::cssSelector('#tiny-compress-savings p')));
$elements = self::$driver->findElement(WebDriverBy::id('tiny-compress-savings'))->findElements(WebDriverBy::tagName('p'));
$statuses = array_map('innerText', $elements);
$this->assertContains('You have saved a total of 53.0 kB on images!', $statuses);
}
示例12: login
function login($driver)
{
print "Logging in to WordPress... ";
$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'))->clear()->click()->sendKeys('admin');
$driver->findElement(WebDriverBy::tagName('form'))->submit();
$dashboardHeading = $driver->findElement(WebDriverBy::xpath("//html/body//div[@class='wrap']/*[self::h1 or self::h2]"));
if ($dashboardHeading->getText() == 'Dashboard') {
print "success!\n";
} else {
var_dump($driver->getPageSource());
throw new UnexpectedValueException('Login failed.');
}
}
示例13: testStatusPresenseFail
public function testStatusPresenseFail()
{
$this->set_api_key('INVALID123');
self::$driver->wait(2)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::cssSelector('#tiny-compress-status p')));
$elements = self::$driver->findElement(WebDriverBy::id('tiny-compress-status'))->findElements(WebDriverBy::tagName('p'));
$statuses = array_map('innerText', $elements);
$this->assertContains('API connection unsuccessful', $statuses);
}
示例14: testSearchUsage
/**
* Test general search controls
* @test
*/
public function testSearchUsage()
{
self::$helper->createRoomAttribute("Beamer");
self::$helper->createRoom('123', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 2));
#1 Use "New search" Button
self::$helper->searchForRoomByAll("123", 5, date("d"), self::$helper->getCurrentMonth(), date("Y") + 1, date("H"), date("i"), "23", "55", array("Beamer" => 1));
self::$webDriver->findElement(WebDriverBy::linkText(' Neue Suche '))->click();
try {
self::$webDriver->findElement(WebDriverBy::name('cmd[applySearch]'));
} catch (Exception $ex) {
$this->fail("#1 Back link does not link back" . $ex);
}
#2 Test if search remains stable after using link
$this->assertEquals("123", self::$webDriver->findElement(WebDriverBy::id('room_name'))->getAttribute("value"));
$this->assertEquals("5", self::$webDriver->findElement(WebDriverBy::id('room_seats'))->getAttribute("value"));
$this->assertEquals("1", self::$webDriver->findElement(WebDriverBy::id('attribute_Beamer_amount'))->getAttribute("value"));
$options = self::$webDriver->findElements(WebDriverBy::tagName('option'));
$counter = 0;
foreach ($options as $option) {
$selected = $option->getAttribute('selected');
if (!empty($selected)) {
switch ($counter) {
case 0:
$this->assertEquals(date("d"), $option->getText());
break;
case 1:
$this->assertEquals(self::$helper->getCurrentMonth(), $option->getText());
break;
case 2:
$this->assertEquals(date("Y") + 1, $option->getText());
break;
case 3:
$this->assertEquals(date("H"), $option->getText());
break;
case 4:
$this->assertEquals(date("i"), $option->getText());
break;
case 5:
$this->assertEquals("23", $option->getText());
break;
case 6:
$this->assertEquals("55", $option->getText());
break;
}
$counter++;
}
}
#3 Reset the search
self::$webDriver->findElement(WebDriverBy::name('cmd[resetSearch]'))->click();
$this->assertEquals("", self::$webDriver->findElement(WebDriverBy::id('room_name'))->getAttribute("value"));
$this->assertEquals("", self::$webDriver->findElement(WebDriverBy::id('room_seats'))->getAttribute("value"));
$this->assertEquals("", self::$webDriver->findElement(WebDriverBy::id('attribute_Beamer_amount'))->getAttribute("value"));
$options = self::$webDriver->findElements(WebDriverBy::tagName('option'));
$counter = 0;
foreach ($options as $option) {
$selected = $option->getAttribute('selected');
if (!empty($selected)) {
switch ($counter) {
case 0:
$this->assertEquals(date("d"), $option->getText());
break;
case 1:
$this->assertEquals(self::$helper->getCurrentMonth(), $option->getText());
break;
case 2:
$this->assertEquals(date("Y"), $option->getText());
break;
case 3:
$this->assertEquals(date("H") + 1, $option->getText());
break;
case 4:
$this->assertEquals(0, $option->getText());
break;
case 5:
$this->assertEquals(date("H") + 2, $option->getText());
break;
case 6:
$this->assertEquals(0, $option->getText());
break;
}
$counter++;
}
}
self::$helper->deleteAllRooms();
}
示例15: disable_resize
protected function disable_resize()
{
$url = wordpress('/wp-admin/options-media.php');
if (self::$driver->getCurrentUrl() != $url) {
self::$driver->get($url);
}
$element = self::$driver->findElement(WebDriverBy::id('tinypng_resize_original_enabled'));
if ($element->getAttribute('checked')) {
$element->click();
}
self::$driver->findElement(WebDriverBy::tagName('form'))->submit();
}