本文整理汇总了PHP中SeleniumClient\By::className方法的典型用法代码示例。如果您正苦于以下问题:PHP By::className方法的具体用法?PHP By::className怎么用?PHP By::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SeleniumClient\By
的用法示例。
在下文中一共展示了By::className方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMenuItemTypes
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;
}