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


PHP WebDriverBy::className方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: testShouldNotLogCommandsInNormalMode

 public function testShouldNotLogCommandsInNormalMode()
 {
     $this->setDebugMode(false);
     // Make debug mode disabled
     $this->driver->findElement(\WebDriverBy::className('foo'));
     $this->driver->getTitle();
     $this->expectOutputString('');
 }
开发者ID:mhujer,项目名称:steward,代码行数:8,代码来源:RemoteWebDriverTest.php

示例5: testRoomSearch

 /**
  * Test searchs based only on rooms.
  * @test
  */
 public function testRoomSearch()
 {
     //#1 Search for room only with numbers
     self::$helper->createRoomAttribute("Beamer");
     self::$helper->createRoom('123', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 3));
     self::$helper->searchForRoomByName("123");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     $this->assertEquals("123", self::$helper->getFirstResult());
     //#2 Search for room with letter
     self::$helper->createRoom('032a', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 1));
     self::$helper->searchForRoomByName("032a");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     $this->assertEquals("032a", self::$helper->getFirstResult());
     //#3 Search for 123a to trigger intelligent search
     self::$helper->searchForRoomByName("123a");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     $this->assertEquals("123", self::$helper->getFirstResult());
     try {
         self::$webDriver->findElement(WebDriverBy::className('ilInfoMessage'));
     } catch (Exception $ex) {
         $this->fail("#3 Intelligent Search did not give a message" . $ex);
     }
     //#4 Search for empty room
     self::$helper->searchForRoomByName("");
     $this->assertEquals("2", self::$helper->getNoOfResults());
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('123'));
         self::$webDriver->findElement(WebDriverBy::linkText('032a'));
     } catch (Exception $ex) {
         $this->fail("#4 Searching for all rooms did not find all rooms");
     }
     //#5 Search for only letter room
     self::$helper->searchForRoomByName("IA");
     $this->assertEquals("0", self::$helper->getNoOfResults());
     self::$helper->createRoom('IA', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 1));
     self::$helper->searchForRoomByName("IA");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     $this->assertEquals("IA", self::$helper->getFirstResult());
     //#6 (intelligent) search for room with - signed numbers
     self::$helper->searchForRoomByName("-123");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     //#7 (intelligent) search for room with + signed numbers
     self::$helper->searchForRoomByName("+123");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     //#8 Test SQL Injection
     self::$helper->searchForRoomByName("\\';SELECT * FROM usr;--");
     $this->assertEquals("0", self::$helper->getNoOfResults());
     //#9 Search for multiple rooms
     self::$helper->searchForRoomByName("2");
     $this->assertEquals("2", self::$helper->getNoOfResults());
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('123'));
         self::$webDriver->findElement(WebDriverBy::linkText('032a'));
     } catch (Exception $ex) {
         $this->fail("#9 Searching for rooms containing 2 did not find all rooms");
     }
     self::$helper->deleteAllRooms();
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:62,代码来源:ilRoomSharingAcceptanceSearchTest.php

示例6: testSearch

 public function testSearch()
 {
     $sites = array('menshealth' => array('site_url' => 'http://www.menshealth.com', 'burger_link' => 'a#menu-btn-toggle'), 'runnersworld' => array('site_url' => 'http://www.runnersworld.com', 'burger_link' => 'a.menu-icon-link'), 'womenshealth' => array('site_url' => 'http://www.womenshealthmag.com', 'burger_link' => 'a#menu-btn-toggle'));
     foreach ($sites as $site) {
         $this->driver->get($site['site_url']);
         $search_term = 'fitness';
         $search_link = $this->driver->findElement(WebDriverBy::className('search-submit'));
         $search_link->click();
         $search_field = $this->driver->findElement(WebDriverBy::className('search-text'));
         $search_field->sendKeys($search_term)->submit();
         $results_stats = $this->driver->findElement(WebDriverBy::cssSelector('.google-appliance-search-stats .placeholder'));
         $this->assertContains($search_term, $results_stats->getText());
     }
 }
开发者ID:karschsp,项目名称:travisbox,代码行数:14,代码来源:search.php

示例7: testNavBar

 public function testNavBar()
 {
     $this->driver->get('http://localhost:80/index.php');
     $menu = $this->driver->findElement(WebDriverBy::id('navcontent'))->findElement(WebDriverBy::tagName('ul'));
     //assert that we are not in mobile mode when maximized
     $this->driver->manage()->window()->maximize();
     $this->assertFalse(strpos($menu->getAttribute("class"), "mobilemenu"));
     //assert that we are in mobile mode with a small window
     $this->driver->manage()->window()->setSize(new WebDriverDimension(450, 600));
     $this->driver->wait(2, 250)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::className("mobilemenu")));
     $this->assertContains("mobilemenu", $menu->getAttribute("class"));
     //assert that reverting back clears mobile mode
     $this->driver->manage()->window()->maximize();
     //$this->driver->wait(2, 250)->until(WebDriverExpectedCondition::not(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::className("mobilemenu"))));
     sleep(1);
     $this->assertFalse(strpos($menu->getAttribute("class"), "mobilemenu"));
 }
开发者ID:hoff121324,项目名称:GlassWebsite,代码行数:17,代码来源:interfaceTest.php

示例8: testSearch

 public function testSearch()
 {
     $this->webDriver->get($this->url);
     // find search field by its id
     $search = $this->webDriver->findElement(WebDriverBy::xpath('html/body/div[1]/div[1]/div/div[2]/form/label'));
     $search->click();
     // typing into field
     $this->webDriver->getKeyboard()->sendKeys('php-webdriver');
     // pressing "Enter"
     $this->webDriver->getKeyboard()->pressKey(WebDriverKeys::ENTER);
     $firstResult = $this->webDriver->findElement(WebDriverBy::cssSelector('li.repo-list-item:nth-child(1) > h3:nth-child(2) > a:nth-child(1)'));
     $firstResult->click();
     // we expect that facebook/php-webdriver was the first result
     $this->assertContains("php-webdriver", $this->webDriver->getTitle());
     $this->assertEquals('https://github.com/facebook/php-webdriver', $this->webDriver->getCurrentURL());
     $this->assertElementNotFound(WebDriverBy::className('avatar'));
 }
开发者ID:unlimUA,项目名称:Codeception,代码行数:17,代码来源:GitHubTest.php

示例9: testSearch

 public function testSearch()
 {
     $this->webDriver->get($this->url);
     // find search field by its id
     $search = $this->webDriver->findElement(WebDriverBy::id('js-command-bar-field'));
     $search->click();
     // typing into field
     $this->webDriver->getKeyboard()->sendKeys('php-webdriver');
     // pressing "Enter"
     $this->webDriver->getKeyboard()->pressKey(WebDriverKeys::ENTER);
     $firstResult = $this->webDriver->findElement(WebDriverBy::cssSelector('li.public:nth-child(1) > h3:nth-child(3) > a:nth-child(1) > em:nth-child(2)'));
     $firstResult->click();
     // we expect that facebook/php-webdriver was the first result
     $this->assertContains("php-webdriver", $this->webDriver->getTitle());
     $this->assertEquals('https://github.com/facebook/php-webdriver', $this->webDriver->getCurrentURL());
     $this->assertElementNotFound(WebDriverBy::className('avatar'));
     // $this->waitForUserInput();
 }
开发者ID:popstas,项目名称:php-webdriver-demo,代码行数:18,代码来源:GitHubTest.php

示例10: array

<?php

// An example of using php-webdriver.
require_once 'lib/__init__.php';
// start Firefox with 5 second timeout
$host = 'http://localhost:4444/wd/hub';
// this is the default
$capabilities = array(WebDriverCapabilityType::BROWSER_NAME => 'firefox');
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
// navigate to 'http://docs.seleniumhq.org/'
$driver->get('http://docs.seleniumhq.org/');
// adding cookie
$driver->manage()->deleteAllCookies();
$driver->manage()->addCookie(array('name' => 'cookie_name', 'value' => 'cookie_value'));
$cookies = $driver->manage()->getCookies();
print_r($cookies);
// click the link 'About'
$link = $driver->findElement(WebDriverBy::id('menu_about'));
$link->click();
// print the title of the current page
echo "The title is " . $driver->getTitle() . "'\n";
// print the title of the current page
echo "The current URI is " . $driver->getCurrentURL() . "'\n";
// Search 'php' in the search box
$input = $driver->findElement(WebDriverBy::id('q'));
$input->sendKeys('php')->submit();
// wait at most 10 seconds until at least one result is shown
$driver->wait(10)->until(WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(WebDriverBy::className('gsc-result')));
// close the Firefox
$driver->quit();
开发者ID:lenninsanchez,项目名称:donadores,代码行数:30,代码来源:example.php

示例11: testRoomEditing

 /**
  * Tests the editing of rooms.
  * @test
  */
 public function testRoomEditing()
 {
     self::$helper->createRoom('name1', 1, 2, "type1", " - Keine Zuordnung - ");
     self::$helper->createRoom('name2', 1, 2, "type2", " - Keine Zuordnung - ");
     // edit room1: change name to name2 -> fail
     self::$helper->editRoom('name1', 'name2', 1, 2, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#1 Editing of a room name to existing name has succeeded" . $ex);
     }
     // edit room1: change name to empty string -> fail
     self::$helper->editRoom('name1', '', 1, 2, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#2 Editing of a room name to empty string has succeeded" . $ex);
     }
     // edit room1: change seats to empty string -> fail
     self::$helper->editRoom('name1', 'name1', 1, '', "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#3 Editing of room seats to empty string has succeeded" . $ex);
     }
     // edit room1: change seats to less than min seats -> fail
     self::$helper->editRoom('name1', 'name1', 2, 1, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#4 Editing of room seats to less than min seats has succeeded" . $ex);
     }
     // edit room1: change seats to negative seats -> fail
     self::$helper->editRoom('name1', 'name1', 1, -1, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#5 Editing of room seats negative seats has succeeded" . $ex);
     }
     // edit room1: change name to name3 -> success
     self::$helper->editRoom('name1', 'name3', 1, 2, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("name3"));
         self::$webDriver->findElement(WebDriverBy::linkText("name2"));
     } catch (Exception $ex) {
         $this->fail("#6 Editing of room name has failed" . $ex);
     }
     // edit room2: change name to name1 -> success
     self::$helper->editRoom('name2', 'name1', 1, 2, "type2", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("name3"));
         self::$webDriver->findElement(WebDriverBy::linkText("name1"));
     } catch (Exception $ex) {
         $this->fail("#7 Editing of room name has failed" . $ex);
     }
     // edit room1: change name to name2 -> success
     self::$helper->editRoom('name3', 'name2', 1, 2, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("name2"));
         self::$webDriver->findElement(WebDriverBy::linkText("name1"));
     } catch (Exception $ex) {
         $this->fail("#8 Editing of room name has failed" . $ex);
     }
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:68,代码来源:ilRoomSharingAcceptanceRoomTest.php

示例12: orderMedications

function orderMedications($driver, $name)
{
    goHome($driver);
    $medication = $driver->findElement(WebDriverBy::linkText('Medication List'));
    $medication->click();
    $driver->wait(65);
    $order = $driver->findElement(WebDriverBy::className('btn'));
    $order->click();
    $driver->findElement(WebDriverBy::name("quantity"))->sendKeys("23");
    $driver->findElement(WebDriverBy::name("name"))->sendKeys($name);
    $order = $driver->findElement(WebDriverBy::className('btn'));
    $order->click();
    //  $driver->findElement(WebDriverBy::name("quantity"))->sendKeys("5");
    //  $driver->findElement(WebDriverBy::name("name"))->sendKeys($name);
    //  $order = $driver->findElement(WebDriverBy::className('btn'));
    //  $order->click();
    goHome($driver);
}
开发者ID:joshsimard,项目名称:COMP4350-Project,代码行数:18,代码来源:helper.php

示例13: testAppointmentPrivileges

 public function testAppointmentPrivileges()
 {
     #1 check without any privilege
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     try {
         $webDriver->findElement(webDriverBy::linkText('Termine'));
         $this->fail("#1 Appointments are displayed even if there's no privilege");
     } catch (Exception $ex) {
         //Nothing to do here - the Element musn't be found!
     }
     #2 check with the privilege to see appointments and administrate booking attributes
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     $class_1_id = self::$helper->getPrivilegeClassIDByNamePartial(self::$classname_1);
     self::$helper->grantPrivilege('accessAppointments', $class_1_id);
     self::$helper->grantPrivilege('adminBookingAttributes', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::linkText('Termine'))->isDisplayed(), '#2 - 1 Appointments are not displayed even the privilege is granted');
     $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::linkText('Termine'))->isDisplayed(), '#2 - 2 Attributes are not displayed even the privilege is granted');
     # Check if non_public bookings are not displayed
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     //Create a non-public booking
     self::$helper->createRoom(self::$standard_roomname, '1', '10');
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "12", "00", "1", "1", date("Y") + 1, "13", "00", '');
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(0, self::$helper->getNoOfResults(), "#3 A non-public booking is visible to an user without the privilege");
     #4 Check the privilege to see non-public bookings
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     self::$helper->grantPrivilege('seeNonPublicBookingInformation', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(1, self::$helper->getNoOfResults(), "#4 A non-public booking is not visible to an user with the privilege");
     #5 Check if the search is accessible
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     self::$helper->grantPrivilege('accessSearch', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::linkText('Suche'))->isDisplayed(), '#5 Search is not displayed even the privilege is granted');
     #6 Check if the "add booking"-link is not showed, if the privilege isn't given
     try {
         $webDriver->findElement(webDriverBy::partialLinkText('Buchung hinzufügen'))->click();
         $this->fail('#6 Add Booking is acceptible without the privilege');
     } catch (Exception $ex) {
         //Nothing to do - the exception should come
     }
     #7 Check if the "add booking"-link is showed if the privilege is given
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     self::$helper->grantPrivilege('addOwnBookings', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::partialLinkText('Buchung hinzufügen'))->isDisplayed(), '#7 Add Booking is not displayed even the privilege is granted');
     #8 Check if a user with a higher Priority can oust another booking
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "15", "00", "1", "1", date("Y") + 1, "16", "00", '');
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "17", "00", "1", "1", date("Y") + 1, "18", "00", '');
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     $class_2_id = self::$helper->getPrivilegeClassIDByNamePartial(self::$classname_2);
     self::$helper->grantPrivilege('cancelBookingLowerPriority', $class_2_id);
     self::$helper->grantPrivilege('accessSearch', $class_2_id);
     self::$helper->grantPrivilege('seeNonPublicBookingInformation', $class_2_id);
     self::$helper->grantPrivilege('accessAppointments', $class_2_id);
     self::$helper->grantPrivilege('addOwnBookings', $class_2_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_2_login, self::$new_user_2_pw);
     self::$helper->toRSS();
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "15", "00", "1", "1", date("Y") + 1, "16", "00", '');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
//.........这里部分代码省略.........
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:101,代码来源:ilRoomSharingAcceptancePrivilegeTest.php

示例14: testGetByClassName

 public function testGetByClassName()
 {
     $this->driver->get($this->getTestPath('index.html'));
     self::assertEquals('Test by Class', $this->driver->findElement(WebDriverBy::className('test_class'))->getText());
 }
开发者ID:DGCarramona,项目名称:php-webdriver,代码行数:5,代码来源:BaseTest.php

示例15: testImport

 /**
  * Test import for DaVinci as far as possible
  */
 public function testImport()
 {
     #1 Import without file
     self::$helper->importDaVinciFile('');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#1 Import no file does work");
     }
     #2 Import with false file
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'fail.txt');
     try {
         //No error message
         //self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#2 Import a false/corrupted file does work");
     }
     #3 Import with false file type
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'fail.pdf');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#3 Import a false file type does work");
     }
     #4 Import with bookings but without rooms
     //Imports rooms too!
     //self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', true, false, 20);
     try {
         //self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#4 Import bookings without rooms does work");
     }
     #5 Import without bookings, only rooms with -1 seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, -1);
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#5 Import room with -1 seats does work");
     }
     #6 Import without bookings, only rooms with "ab" seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, "ab");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#6 Import room with ab seats does work");
     }
     #7 Import without bookings, only rooms with 0 seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, 0);
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#7 Import room with 0 seats does work");
     }
     #8 Import without bookings, only rooms with "" seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, "");
     try {
         //Missing Error Message
         //self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#8 Import room with no seats does work");
     }
     #9 Import without bookings, only rooms with 20 seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, 20);
     try {
         //No sucess message
         //self::$webDriver->findElement(WebDriverBy::className("ilInfoMessage"));
         self::$webDriver->findElement(WebDriverBy::linkText('Räume'))->click();
         self::$webDriver->findElement(WebDriverBy::linkText('I117'));
     } catch (Exception $ex) {
         $this->fail('#9.1 Import rooms does not work');
     }
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Keine Einträge']"));
     } catch (Exception $ex) {
         $this->fail('#9.2 Import rooms also imports bookings');
     }
     #10 Import bookings to rooms
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', true, false, 20);
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Keine Einträge']"));
         $this->fail('#10 Import bookings does not work');
     } catch (Exception $ex) {
         //Comes here when sucessful!
     }
     #11 Override all
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', true, true, 10);
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Räume'))->click();
         self::$webDriver->findElement(WebDriverBy::linkText('I117'));
     } catch (Exception $ex) {
         $this->fail('#11.1 Override rooms does not work');
     }
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Keine Einträge']"));
//.........这里部分代码省略.........
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:101,代码来源:ilRoomSharingAcceptanceImportExportTest.php


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