当前位置: 首页>>代码示例>>PHP>>正文


PHP WebDriverBy::Id方法代码示例

本文整理汇总了PHP中WebDriverBy::Id方法的典型用法代码示例。如果您正苦于以下问题:PHP WebDriverBy::Id方法的具体用法?PHP WebDriverBy::Id怎么用?PHP WebDriverBy::Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebDriverBy的用法示例。


在下文中一共展示了WebDriverBy::Id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _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");
         }
     }
 }
开发者ID:spaiva,项目名称:Loris,代码行数:32,代码来源:candidate_listTest.php

示例2: testDocumentRepositoryUploadFileEditDeleteComment

 /**
  * Tests that, upload function in document_repository module
  *
  * @return void
  */
 function testDocumentRepositoryUploadFileEditDeleteComment()
 {
     $this->markTestSkipped("This method isn't working properly on travis.");
     $this->safeGet($this->url . "/document_repository/");
     $this->safeFindElement(WebDriverBy::Xpath("//*[@id='TESTTESTTESTTESTa']/td/span"))->click();
     $this->safeFindElement(WebDriverBy::Id("9999999"))->click();
     // modify comment,search it and check it
     $select = $this->safeFindElement(WebDriverBy::Id("categoryEdit"));
     $element = new WebDriverSelect($select);
     $element->selectByVisibleText("TESTTESTTESTTEST");
     $site = $this->safeFindElement(WebDriverBy::Id("siteEdit"));
     $elementSite = new WebDriverSelect($site);
     $elementSite->selectByVisibleText("Any");
     $this->safeFindElement(WebDriverBy::Id("commentsEdit"))->sendKeys("This is a test comment!");
     $this->safeFindElement(WebDriverBy::Id("postEdit"))->click();
     sleep(5);
     $this->safeFindElement(WebDriverBy::Name("File_name"))->sendKeys("README.md");
     $this->safeFindElement(WebDriverBy::Name("filter"))->click();
     $text = $this->safeFindElement(WebDriverBy::cssSelector("#dir-tree > tr"), 3000)->getText();
     $this->assertContains("This is a test comment!", $text);
     // delete upload file
     $this->safeFindElement(WebDriverBy::linkText("Delete"), 3000)->click();
     $this->safeFindElement(WebDriverBy::Id("postDelete"))->click();
     $this->safeFindElement(WebDriverBy::Name("File_name"))->sendKeys("README.md");
     $this->safeFindElement(WebDriverBy::Name("filter"))->click();
     sleep(5);
     $text = $this->safeFindElement(WebDriverBy::cssSelector("tbody"), 3000)->getText();
     $this->assertEquals('', $text);
 }
开发者ID:spaiva,项目名称:Loris,代码行数:34,代码来源:document_repositoryTest.php


注:本文中的WebDriverBy::Id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。