本文整理汇总了PHP中WebDriverBy::ClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP WebDriverBy::ClassName方法的具体用法?PHP WebDriverBy::ClassName怎么用?PHP WebDriverBy::ClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebDriverBy
的用法示例。
在下文中一共展示了WebDriverBy::ClassName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _validateSessionTableContents
/**
* Checks the contents of the session table and compares it against an expected
* result.
*
* @param array $expectedSessions list of all the expected sessions.
*
* @return void
*/
private function _validateSessionTableContents($expectedSessions)
{
$sessionTable = $this->webDriver->findElements(WebDriverBy::ClassName('dynamictable'));
$actualSessions = $sessionTable[1]->findElements(WebDriverBy::xpath('.//tbody//tr'));
$this->assertEquals(count($actualSessions), count($expectedSessions), "Number of visits should be " . count($expectedSessions) . ", not " . count($actualSessions));
for ($i = 0; $i < count($actualSessions); $i++) {
$elements = $actualSessions[$i]->findElements(WebDriverBy::xpath('.//td'));
$actualSession = array();
foreach ($elements as $e) {
$actualSession[] = $e->getText();
}
$this->assertEquals($expectedSessions[$i], $actualSession, "Sessions at row {$i} differ");
}
}
示例2: _assertCandidateTableContents
/**
* Compares the content of the candidate table with an expected content.
*
* @param string $tableName name of the HTML table.
* @param string $expectedRows array of candidates that the table should contain.
*
* @return void
*/
private function _assertCandidateTableContents($tableName, $expectedRows)
{
if (is_null($expectedRows)) {
$wait = new WebDriverWait($this->webDriver, 15);
$wait->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::ClassName('no-result-found-panel')));
$element = $this->webDriver->findElement(WebDriverBy::ClassName('no-result-found-panel'));
$this->assertContains('No result found', $element->getText());
} else {
$wait = new WebDriverWait($this->webDriver, 15);
$wait->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::Id('dynamictable')));
$dataTable = $this->webDriver->findElement(WebDriverBy::Id('dynamictable'));
$actualRows = $dataTable->findElements(WebDriverBy::xpath('.//tbody//tr'));
$this->assertEquals(count($actualRows), count($expectedRows), "Number of candidates returned should be " . count($expectedRows) . ", not " . count($actualRows));
for ($i = 0; $i < count($actualRows); $i++) {
$elements = $actualRows[$i]->findElements(WebDriverBy::xpath('.//td'));
$actualColumns = array();
foreach ($elements as $e) {
$actualColumns[] = $e->getText();
}
$expectedColumns = $expectedRows[$i];
$this->assertEquals($actualColumns, $expectedColumns, "Candidates at row {$i} differ");
}
}
}
示例3: _assertUserTableContents
/**
* Compares the content of the candidate table with an expected content.
*
* @param string $className class name of the HTML table.
* @param string $expectedRows array of candidates that the table should contain.
*
* @return void
*/
private function _assertUserTableContents($className, $expectedRows)
{
$dataTable = $this->safeFindElement(WebDriverBy::ClassName($className));
if (is_null($expectedRows)) {
$this->assertContains('No users found', $dataTable->getText());
} else {
$actualRows = $dataTable->findElements(WebDriverBy::xpath('.//tbody//tr'));
$this->assertEquals(count($actualRows), count($expectedRows), "Number of users returned should be " . count($expectedRows) . ", not " . count($actualRows));
for ($i = 1; $i <= count($actualRows); $i++) {
$elements = $actualRows[$i - 1]->findElements(WebDriverBy::xpath('.//td'));
$actualColumns = array();
foreach ($elements as $e) {
$actualColumns[] = $e->getText();
}
$expectedColumns = $expectedRows[$i - 1];
array_unshift($expectedColumns, "{$i}");
$this->assertEquals($actualColumns, $expectedColumns, "Users at row {$i} differ");
}
}
}