本文整理汇总了PHP中SeleniumClient\By::tagName方法的典型用法代码示例。如果您正苦于以下问题:PHP By::tagName方法的具体用法?PHP By::tagName怎么用?PHP By::tagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SeleniumClient\By
的用法示例。
在下文中一共展示了By::tagName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModuleTitles
/**
* Gets the titles of modules in sliders
*
* @return array of stdClass objects
*/
public function getModuleTitles()
{
$container = $this->driver->findElement(By::Id('panel-sliders'));
$elements = $container->findElements(By::tagName('h3'));
$return = array();
foreach ($elements as $element) {
$object = new stdClass();
$object->text = $element->getText();
}
}
示例2: getMenuItemTypes
/**
* function to get all menu types
*
* @return array
*/
public function getMenuItemTypes()
{
$result = array();
$d = $this->driver;
$d->findElement(By::xPath("//a[contains(@onclick, 'option=com_menus&view=menutypes')]"))->click();
$el = $d->waitForElementUntilIsPresent(By::xPath("//iframe[contains(@src, 'option=com_menus&view=menutypes')]"));
$el = $d->switchTo()->getFrameByWebElement($el);
$groups = $d->findElements(By::className('accordion-group'));
foreach ($groups as $group) {
$toggle = $group->findElement(By::className('accordion-toggle'));
$toggleName = $toggle->getText();
$toggle->click();
$d->waitForElementUntilIsPresent(By::xPath("//div[contains(@class, 'accordion-body in')]/div/ul/li/a"));
$menuTypes = $el->findElements(By::xPath("//div[contains(@class, 'accordion-body in')]/div/ul/li/a"));
foreach ($menuTypes as $menuType) {
$allText = $menuType->getText();
$subTextLength = strlen($menuType->findElement(By::tagName('small'))->getText());
$menuTypeText = substr($allText, 0, strlen($allText) - $subTextLength);
$result[] = array('group' => $toggleName, 'type' => $menuTypeText);
}
}
return $result;
}
示例3: getVisibleMenuLinks
/**
* Gets array of visible links in the menu container
* This is normally the header menu for back-end manager screens
*
* @return array of stdClass objects
*/
public function getVisibleMenuLinks()
{
$menuContainer = $this->driver->findElement(By::id('menu'));
$menus = $menuContainer->findElements(By::tagName('a'));
$return = array();
foreach ($menus as $menu) {
if ($text = $menu->getText()) {
$menuObject = new stdClass();
$menuObject->text = $text;
$menuObject->href = $menu->getAttribute('href');
$menuObject->id = $menu->getElementId();
$return[] = $menuObject;
}
}
return $return;
}
示例4: toWikiHelpSelect
/**
* Prepare wiki text for an option group
* Format is: *'''<label>:''' (<option1>/<option2/..) <tooltip text>
*/
public function toWikiHelpSelect(stdClass $object)
{
$optionContainer = $this->driver->findElement(By::xPath("//div[@id='" . $object->id . "_chzn']"));
$optionContainer->click();
$optionList = $optionContainer->findElement(By::tagName('ul'));
$optionText = $this->getOptionText($optionList);
return "*'''" . $object->labelText . ":''' (" . implode('/', $optionText) . "). " . $this->getToolTip($object->tab, $object->id) . "\n";
}
示例5: toWikiHelpPermissions
/**
* Prepare wiki text for permissions tab
*
*/
public function toWikiHelpPermissions($groupId)
{
$objects = $this->getPermissionInputFields($groupId);
foreach ($objects as $object) {
$listElement = str_replace('.', '_', $object->id);
$optionContainer = $this->driver->findElement(By::xPath("//div[@id='" . $listElement . "_chzn']"));
$optionContainer->findElement(By::tagName('a'))->click();
$optionList = $optionContainer->findElement(By::tagName('ul'));
$optionText = $this->getOptionText($optionList);
$toolTip = $object->element->getAttribute('title') . ". " . $object->tipText;
$helpText[] = "*'''" . $object->labelText . ":''' (" . implode('/', $optionText) . "). " . $toolTip . "\n";
$optionContainer->findElement(By::tagName('a'))->click();
}
return $helpText;
}
示例6: testFindElements
public function testFindElements()
{
$this->_driver->get($this->_url);
$webElements = $this->_driver->findElements(By::tagName("input"));
foreach ($webElements as $webElement) {
$this->assertTrue($webElement instanceof WebElement);
}
$this->assertTrue(is_array($webElements));
$this->assertTrue(count($webElements) > 0);
}
示例7: getRowText
public function getRowText($name)
{
$result = false;
$rowElements = $this->driver->findElement(By::xPath("//tbody"))->findElements(By::tagName('tr'));
$count = count($rowElements);
for ($i = 0; $i < $count; $i++) {
$rowText = $rowElements[$i]->getText();
if (strpos($rowText, $name) !== false) {
$result = $rowText;
break;
}
}
return $result;
}
示例8: testFindElementsShouldGetOneOfFoundElementsText
public function testFindElementsShouldGetOneOfFoundElementsText()
{
$selectBox = $this->_driver->findElement(By::id("sel1"));
$selectBoxOptions = $selectBox->findElements(By::tagName("option"));
foreach ($selectBoxOptions as $selectBoxOption) {
$this->assertTrue($selectBoxOption instanceof WebElement);
if ($selectBoxOption->getAttribute("value") == "4") {
$selectBoxOption->click();
}
}
foreach ($selectBoxOptions as $selectBoxOption) {
if ($selectBoxOption->getAttribute("selected") == "true") {
$this->assertEquals("Black", $selectBoxOption->getText());
}
}
}