當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WebDriverBy類代碼示例

本文整理匯總了PHP中WebDriverBy的典型用法代碼示例。如果您正苦於以下問題:PHP WebDriverBy類的具體用法?PHP WebDriverBy怎麽用?PHP WebDriverBy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了WebDriverBy類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sampleTest

 /** @test */
 public function sampleTest()
 {
     $page = $this->driver->get('http://slovicka.my');
     $this->assertContains('Slovicka', $page->getTitle());
     $username = $this->driver->findElement(WebDriverBy::name('_username'));
     $username->sendKeys('jirkakoutny@gmail.com');
 }
開發者ID:netucz,項目名稱:slovicka,代碼行數:8,代碼來源:SampleSeleniumTest.php

示例2: findElements

 /**
  * Find all WebDriverElements within the current page using the given
  * mechanism.
  *
  * @param WebDriverBy $by
  * @return array A list of all WebDriverElements, or an empty array if
  *    nothing matches
  * @see WebDriverBy
  */
 public function findElements(WebDriverBy $by)
 {
     $params = array('using' => $by->getMechanism(), 'value' => $by->getValue());
     $raw_elements = $this->executor->execute('findElements', $params);
     $elements = array();
     foreach ($raw_elements as $raw_element) {
         $elements[] = $this->newElement($raw_element['ELEMENT']);
     }
     return $elements;
 }
開發者ID:roeyb,項目名稱:PHP-WebDriver-Phantomjs-Selenium,代碼行數:19,代碼來源:RemoteWebDriver.php

示例3: click_product_by_link_text

 /**
  * Поиск продукта по названию и переход на страницу
  * @param  String $link_text
  * @return Page_Product
  */
 public function click_product_by_link_text($link_text)
 {
     $wait = new WebDriverWait($this->web_driver, 30);
     $wait->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::linkText($link_text)));
     $this->web_driver->findElement(WebDriverBy::linkText($link_text))->click();
     return new Page_Product($this->web_driver);
 }
開發者ID:puha4,項目名稱:tuscany-selenium-parser,代碼行數:12,代碼來源:Page_Category.php

示例4: test1

 public function test1()
 {
     $aAdVals = array('ad_id' => 1989, 'location' => array('VN', 'US'), 'ad_type' => Phpfox::getService('socialad.helper')->getConst('ad.type.html'));
     Phpfox::getService('unittest.test.socialad')->insertTestAd($aAdVals);
     $this->driver->get($this->url);
     $search = $this->driver->findElement(WebDriverBy::cssSelector('.header_menu_login_left .header_menu_login_input'));
     $search->click();
     $this->driver->getKeyboard()->sendKeys('minhta@younetco.com');
     // need refactoring
     $search = $this->driver->findElement(WebDriverBy::cssSelector('.header_menu_login_right .header_menu_login_input'));
     $search->click();
     $this->driver->getKeyboard()->sendKeys('123456');
     $search = $this->driver->findElement(WebDriverBy::cssSelector('.header_menu_login_button input'));
     $search->click();
     // checking that page title contains word 'GitHub'
     $by = WebDriverBy::cssSelector('#ynsaAdDisplay_' . $aAdVals['ad_id']);
     $this->assertElementFound($by);
     $search = $this->driver->findElement(WebDriverBy::cssSelector('#ynsaAdDisplay_' . $aAdVals['ad_id']));
     $this->driver->executeScript('$(".ynsaDisplayAdHideButton").show();');
     // $search->click();
     // $this->driver->getMouse()->mouseMove($search->getCoordinates());
     $search = $this->driver->findElement(WebDriverBy::cssSelector('#ynsaAdDisplay_' . $aAdVals['ad_id'] . ' .ynsaDisplayAdHideButton'));
     $search->click();
     $search = $this->driver->findElement(WebDriverBy::cssSelector('#ynsaAdDisplay_' . $aAdVals['ad_id'] . ' .ynsaDisplayAdBlock'));
     $this->assertFalse($search->isDisplayed());
     // need a function convert xPath to css selector
     $search = $this->driver->findElement(WebDriverBy::cssSelector('#header_menu_holder ul:nth-child(1) > li:nth-child(3) > a:nth-child(1)'));
     $search->click();
     $search = $this->driver->findElement(WebDriverBy::cssSelector('#header_menu_holder ul:nth-child(1) > li:nth-child(3) > ul > li:nth-child(6) a'));
     $search->click();
 }
開發者ID:hsz-webdev,項目名稱:phpfoxunittest,代碼行數:31,代碼來源:socialad_hide_ads_test.php

示例5: testGoogle

 public function testGoogle()
 {
     $this->driver->get(Util::buildUrl('/'));
     echo $this->driver->getTitle();
     echo $this->driver->findElement(WebDriverBy::id('id1'))->getText();
     $this->driver->takeScreenshot(ROOT . '/tests/tmp/sc.png');
 }
開發者ID:calpo,項目名稱:trial-selenium-webdriver,代碼行數:7,代碼來源:SampleUnitTest.php

示例6: validaTempoDeMensagemVoceEPassienteEm7Segundos

 /**
  * @test
  */
 public function validaTempoDeMensagemVoceEPassienteEm7Segundos()
 {
     $this->driver->manage()->timeouts()->implicitlyWait(2);
     $this->driver->get($this->url);
     $mensagem = $this->driver->findElement(WebDriverBy::id("mensagem-magica"))->getText();
     $this->assertEquals("Voce e paciente!", $mensagem);
 }
開發者ID:adrielcardoso,項目名稱:TDD_Exemplo_phpunit,代碼行數:10,代碼來源:WebTest.php

示例7: testGoogle2

 public function testGoogle2()
 {
     static::$driver->get(Util::buildUrl('/'));
     echo static::$driver->getTitle();
     echo static::$driver->findElement(WebDriverBy::id('id1'))->getText();
     static::$driver->takeScreenshot(ROOT . '/tests/tmp/sc1.png');
 }
開發者ID:calpo,項目名稱:trial-selenium-webdriver,代碼行數:7,代碼來源:SampleScenarioTest.php

示例8: testUserLocation

 /**
  * @dataProvider userLocations
  */
 public function testUserLocation($proxy, $expected)
 {
     $this->driver = $this->proxied($proxy);
     $this->driver->get($this->url);
     $search = $this->driver->findElement(WebDriverBy::id('user-city'));
     $this->assertContains($expected, $search->getText());
 }
開發者ID:kristiansl,項目名稱:locale-testing-demo,代碼行數:10,代碼來源:WonderProxyHomeTest.php

示例9: testEmptyField

 public function testEmptyField()
 {
     $this->clearData();
     $this->submitForm();
     $this->assertEquals($this->baseUrl . "/system/company", $this->webDriver->getCurrentURL());
     $this->assertEquals(1, count($this->webDriver->findElement(WebDriverBy::className("error-box"))));
 }
開發者ID:gpawlik,項目名稱:laravel-projects-codebase,代碼行數:7,代碼來源:CompanyInsertTest.php

示例10: testProcessOrder

 public function testProcessOrder()
 {
     $this->driver->get($this->getTestPath('/admin'));
     $this->driver->findElement(WebDriverBy::id('username'))->sendKeys('admin');
     $this->driver->findElement(WebDriverBy::id('login'))->sendKeys('P@ssw0rd');
     $this->driver->findElement(WebDriverBy::className('form-button'))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Sales']"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Orders']"))->click();
     $this->driver->wait()->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::id('sales_order_grid_filter_real_order_id')));
     $this->driver->findElement(WebDriverBy::id('sales_order_grid_filter_real_order_id'))->sendKeys('ICANN-D10000014');
     $this->driver->findElement(WebDriverBy::id('sales_order_grid_filter_real_order_id'))->sendKeys(WebDriverKeys::ENTER);
     sleep(3);
     $this->driver->findElement(WebDriverBy::xpath("//html/body/div[1]/div[2]/div/div[3]/div/div[2]/div/table/tbody/tr[1]/td[2]"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Invoice']"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Submit Invoice']"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Ship']"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Add Tracking Number']"))->click();
     $this->driver->findElement(WebDriverBy::id("trackingC1"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//select[@id='trackingC1']/option[@value='fedex']"))->click();
     $this->driver->findElement(WebDriverBy::id("trackingT1"))->sendKeys('FEDEX');
     $this->driver->findElement(WebDriverBy::id("trackingN1"))->sendKeys('Tracking0001');
     $this->driver->findElement(WebDriverBy::id("send_email"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Submit Shipment']"))->click();
     sleep(5);
 }
開發者ID:ngocluu263,項目名稱:ISVEstoreAT,代碼行數:25,代碼來源:BaseTest.php

示例11: urlencode

 /**
  * @test
  */
 public function 質問ページから質問投稿する()
 {
     //        $basic_user = '*******';
     //        $basic_pass = '*******';
     //        $gooid_user = '*******';
     //        $gooid_pass = '*******';
     //        $domain = '*****.goo.ne.jp';
     require __DIR__ . '/../config.php';
     $basic_user = urlencode($basic_user);
     $basic_pass = urlencode($basic_pass);
     $title = 'タイトル' . time();
     $description = '本文' . time();
     $driver = Util::createDriver();
     Util::loginToGoo($driver, $gooid_user, $gooid_pass);
     $driver->get("http://{$basic_user}:{$basic_pass}@{$domain}/question");
     $driver->findElement(\WebDriverBy::id('title_area'))->sendKeys($title);
     $driver->findElement(\WebDriverBy::id('text_area'))->sendKeys($description);
     $driver->findElement(\WebDriverBy::cssSelector('#question_confirm_btn > a > span.q-text'))->click();
     Util::skipPageLenvingAlert($driver);
     $driver->wait(5)->until(\WebDriverExpectedCondition::visibilityOfElementLocated(\WebDriverBy::cssSelector('#match_categories > input')));
     $driver->findElement(\WebDriverBy::cssSelector('#question_complete_button > a'))->click();
     $driver->findElement(\WebDriverBy::cssSelector('li.tooSeeBtn > a'))->click();
     $actual_title = $driver->getTitle();
     $url = $driver->getCurrentUrl();
     preg_match('/\\/qa\\/(\\d+)\\.html/', $url, $matches);
     $qid = $matches[1];
     $trimed_title = preg_replace('/ - .+/', '', $actual_title);
     echo $actual_title . "\n";
     echo $url . "\n";
     echo $qid . "\n";
     $driver->quit();
     $this->assertEquals($title, $trimed_title);
 }
開發者ID:calpo,項目名稱:trial-selenium-webdriver,代碼行數:36,代碼來源:PostQuestionFromQuestionPageTest.php

示例12: testTestPageWelcome

 public function testTestPageWelcome() {
   $this->driver->get($this->getTestPath('index.html'));
   self::assertEquals(
     'Welcome to the facebook/php-webdriver testing page.',
     $this->driver->findElement(WebDriverBy::id('welcome'))->getText()
   );
 }
開發者ID:hendryguna,項目名稱:laravel-basic,代碼行數:7,代碼來源:ExampleTestCase.php

示例13: testBlankFields

 public function testBlankFields()
 {
     //click with empty data
     $this->submitForm();
     $this->assertEquals($this->baseUrl . "/system/permissions/create", $this->webDriver->getCurrentURL());
     $this->assertEquals(1, count($this->webDriver->findElement(WebDriverBy::className("error-box"))));
 }
開發者ID:gpawlik,項目名稱:laravel-projects-codebase,代碼行數:7,代碼來源:PermissionAddTest.php

示例14: testUselessFileDetectorSendKeys

 public function testUselessFileDetectorSendKeys()
 {
     $this->driver->get($this->getTestPath('upload.html'));
     $file_input = $this->driver->findElement(WebDriverBy::id('upload'));
     $file_input->sendKeys($this->getFilePath());
     self::assertEquals($this->getFilePath(), $file_input->getAttribute('value'));
 }
開發者ID:DGCarramona,項目名稱:php-webdriver,代碼行數:7,代碼來源:FileUploadTest.php

示例15: fillSeeDeleteInputField

 /**
  * @param RemoteWebElement $fieldContext
  * @param array $testValues An array of arrays that contains the values to validate.
  *  * First value is the input value
  *  * second value is the value that is expected after the validation
  *  * optional third value is the "internal" value like required for date fields (value is internally
  *      represented by a timestamp). If this value is not defined the second value will be used.
  *  Example for field with alpha validation: [['foo', 'foo'], ['bar1'], ['bar']]
  *  Example for field with date validation: [['29-01-2016', '29-01-2016', '1454025600']]
  */
 public function fillSeeDeleteInputField(RemoteWebElement $fieldContext, array $testValues)
 {
     $I = $this->tester;
     $I->wantTo('Fill field, check the fieldvalue after evaluation and delete the value.');
     $inputField = $fieldContext->findElement(\WebDriverBy::xpath('.//*/input[@data-formengine-input-name]'));
     $internalInputField = $fieldContext->findElement(\WebDriverBy::xpath('.//*/input[@name="' . $inputField->getAttribute('data-formengine-input-name') . '"]'));
     foreach ($testValues as $comment => $testValue) {
         if (!empty($comment)) {
             $I->comment($comment);
         }
         $I->comment('Fill the field and switch focus to trigger validation.');
         $I->fillField($inputField, $testValue[0]);
         // change the focus to trigger validation
         $fieldContext->sendKeys("\n");
         $I->comment('Test value of "visible" field');
         $I->canSeeInField($inputField, $testValue[1]);
         $I->comment('Test value of the internal field');
         $I->canSeeInField($internalInputField, isset($testValue[2]) ? $testValue[2] : $testValue[1]);
     }
     $inputField->findElement(\WebDriverBy::xpath('parent::*/button[@class="close"]'))->click();
     // change the context from the field
     $fieldContext->sendKeys("\n");
     $I->canSeeInField($inputField, '');
     $I->canSeeInField($internalInputField, '');
 }
開發者ID:dachcom-digital,項目名稱:TYPO3.CMS,代碼行數:35,代碼來源:Formhandler.php


注:本文中的WebDriverBy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。