本文整理汇总了PHP中WebDriverBy::name方法的典型用法代码示例。如果您正苦于以下问题:PHP WebDriverBy::name方法的具体用法?PHP WebDriverBy::name怎么用?PHP WebDriverBy::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebDriverBy
的用法示例。
在下文中一共展示了WebDriverBy::name方法的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');
}
示例2: set_api_key
protected function set_api_key($api_key)
{
self::$driver->get(wordpress('/wp-admin/options-media.php'));
self::$driver->findElement(WebDriverBy::name('tinypng_api_key'))->clear()->sendKeys($api_key);
self::$driver->findElement(WebDriverBy::tagName('form'))->submit();
return self::$driver->findElement(WebDriverBy::name('tinypng_api_key'));
}
示例3: iSearchFor
/** @When /^I search for "([^"]*)"$/ */
public function iSearchFor($searchText)
{
$element = $this->webDriver->findElement(WebDriverBy::name("q"));
if ($element) {
$element->sendKeys($searchText);
$element->submit();
}
}
示例4: __construct
/**
* @param RemoteWebDriver $web_driver
*/
function __construct(RemoteWebDriver $web_driver)
{
$this->web_driver = $web_driver;
// Дожидаемся загрузки первого елемента
$wait = new WebDriverWait($this->web_driver, 30);
$wait->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::id('MainContent_Email')));
$this->email = $this->web_driver->findElement(WebDriverBy::id('MainContent_Email'));
$this->password = $this->web_driver->findElement(WebDriverBy::id('MainContent_Password'));
$this->remember = $this->web_driver->findElement(WebDriverBy::id('MainContent_RememberMe'));
$this->submit = $this->web_driver->findElement(WebDriverBy::name('ctl00$MainContent$ctl05'));
}
示例5: testGoogle
public function testGoogle()
{
$web_driver = Util::createDriver();
$web_driver->get("http://www.google.com");
$element = $web_driver->findElement(WebDriverBy::name("q"));
if ($element) {
$element->sendKeys("Browserstack");
$element->submit();
}
$web_driver->quit();
}
示例6: testLogCreatesNewFileOnFirstMessage
function testLogCreatesNewFileOnFirstMessage()
{
echo 'This is a test with simple test';
$web_driver = RemoteWebDriver::create("http://<username>:<access_key>@hub.browserstack.com/wd/hub", array("platform" => "WINDOWS"));
$web_driver->get("http://www.google.com/ncr");
$this->assertEquals("Google", $web_driver->getTitle());
$element = $web_driver->findElement(WebDriverBy::name("q"));
if ($element) {
$element->sendKeys("Browserstack");
$element->submit();
//$this->assertEquals(0, count($stack));
}
$web_driver->quit();
}
示例7: testGoogle
public function testGoogle()
{
$url = "http://" . self::$user_id . ":" . self::$security_key . "@hub.browserstack.com/wd/hub";
$caps = array("browser" => "IE", "browser_version" => "9.0", "os" => "Windows", "os_version" => "7", "browserstack.debug" => "true");
$web_driver = RemoteWebDriver::create($url, $caps);
$web_driver->get("http://www.google.com");
print $web_driver->getTitle();
$element = $web_driver->findElement(WebDriverBy::name("q"));
if ($element) {
$element->sendKeys("Browserstack");
$element->submit();
}
$web_driver->quit();
}
示例8: setUp
public function setUp()
{
$capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'firefox');
$this->webDriver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities);
$this->app = self::createApplication();
//log user in
$this->webDriver->get($this->baseUrl);
$usernameField = $this->webDriver->findElement(WebDriverBy::name("username"));
$usernameField->sendKeys("superuser");
$passwordField = $this->webDriver->findElement(WebDriverBy::name("password"));
$passwordField->sendKeys("mala");
$loginBtn = $this->webDriver->findElement(WebDriverBy::id("login-btn"));
$loginBtn->click();
$this->webDriver->manage()->timeouts()->implicitlyWait(1000);
}
示例9: clearData
protected function clearData()
{
$companyNameTextField = $this->webDriver->findElement(WebDriverBy::name("company_name"));
$companyNameTextField->clear();
$companyDescTextField = $this->webDriver->findElement(WebDriverBy::name("company_description"));
$companyDescTextField->clear();
$companyAddressTextField = $this->webDriver->findElement(WebDriverBy::name("company_address"));
$companyAddressTextField->clear();
$companyTelephoneTextField = $this->webDriver->findElement(WebDriverBy::name("company_telephone"));
$companyTelephoneTextField->clear();
$companyTinNoTextField = $this->webDriver->findElement(WebDriverBy::name("company_tin_number"));
$companyTinNoTextField->clear();
$companySSNITNoTextField = $this->webDriver->findElement(WebDriverBy::name("company_ssnit_number"));
$companySSNITNoTextField->clear();
$companyEmailTextField = $this->webDriver->findElement(WebDriverBy::name("company_email"));
$companyEmailTextField->clear();
$companyWebsiteTextField = $this->webDriver->findElement(WebDriverBy::name("company_website"));
$companyWebsiteTextField->clear();
}
示例10: testFilterPanel
/**
* Tests the filter panel itself in room filter
* @test
*/
public function testFilterPanel()
{
self::$webDriver->findElement(WebDriverBy::linkText('Räume'))->click();
#1: Hide Room Filter
self::$webDriver->findElement(WebDriverBy::linkText('Filter ausblenden'))->click();
$this->assertEquals(false, self::$webDriver->findElement(WebDriverBy::name('cmd[applyRoomFilter]'))->isDisplayed(), '#1 Hiding the RoomFilter does not hide it');
#2: Show Room Filtere
self::$webDriver->findElement(WebDriverBy::linkText('Filter anzeigen'))->click();
$this->assertEquals(true, self::$webDriver->findElement(WebDriverBy::name('cmd[applyRoomFilter]'))->isDisplayed(), '#2 Showing the RoomFilter does not show it');
#3 Apply and hide filter
self::$webDriver->findElement(WebDriverBy::id('room_name'))->sendKeys('123');
self::$webDriver->findElement(WebDriverBy::name('cmd[applyRoomFilter]'))->click();
self::$webDriver->findElement(WebDriverBy::linkText('Filter ausblenden'))->click();
self::$webDriver->findElement(WebDriverBy::linkText('Filter anzeigen'))->click();
$this->assertEquals('123', self::$webDriver->findElement(WebDriverBy::name('room_name'))->getAttribute('value'), '#3 Hiding and showing the RoomFilter resets it');
#4 Reset filter
self::$webDriver->findElement(WebDriverBy::name('cmd[resetRoomFilter]'))->click();
$this->assertEquals(true, empty(self::$webDriver->findElement(WebDriverBy::name('room_name'))->getAttribute('value')), '#4 Filter reseting does not work');
}
示例11: testLogInAndOut
public function testLogInAndOut()
{
$this->driver->get('http://localhost:80/addons/boards.php');
$button = $this->driver->findElement(WebDriverBy::id("navcontent"))->findElement(WebDriverBy::linkText("Log In"));
$button->click();
$this->assertContains("login.php", $this->driver->getCurrentURL());
//$element1 = $this->driver->getActiveElement();
$element1 = $this->driver->findElement(WebDriverBy::name("username"));
$this->assertEquals("input", $element1->getTagName());
//$this->assertEquals("username", $element1->getAttribute("name"));
$element1->sendKeys("4833");
//$element1->sendKeys(KEYS::TAB);
//$element2 = $this->driver->getActiveElement();
$element2 = $this->driver->findElement(WebDriverBy::name("password"));
$this->assertEquals("input", $element1->getTagName());
//$this->assertEquals("password", $element1->getAttribute("name"));
$element2->sendKeys("asdf");
$title = $this->driver->getTitle();
$element2->submit();
$this->driver->wait(5, 250)->until(WebDriverExpectedCondition::not(WebDriverExpectedCondition::titleIs($title)));
$this->assertContains("boards.php", $this->driver->getCurrentURL());
}
示例12: testCalendarEntryEditTest
public function testCalendarEntryEditTest()
{
//edit date
$row = self::$webDriver->findElement(WebDriverBy::xpath("//tr[contains(text(), " . "CalendarTestBooking" . ")]/td[8]"));
$row->findElement(WebDriverBy::linkText('Bearbeiten'))->click();
self::$webDriver->findElement(WebDriverBy::id('from[date]_d'))->sendKeys(date('d') + 1);
self::$webDriver->findElement(WebDriverBy::id('from[date]_m'))->sendKeys(date('m'));
self::$webDriver->findElement(WebDriverBy::id('from[date]_y'))->sendKeys(date('Y'));
self::$webDriver->findElement(WebDriverBy::id('from[time]_h'))->sendKeys("14");
self::$webDriver->findElement(WebDriverBy::id('from[time]_m'))->sendKeys("00");
self::$webDriver->findElement(WebDriverBy::id('to[date]_d'))->sendKeys(date('d') + 1);
self::$webDriver->findElement(WebDriverBy::id('to[date]_m'))->sendKeys(date('m'));
self::$webDriver->findElement(WebDriverBy::id('to[date]_y'))->sendKeys(date('Y'));
self::$webDriver->findElement(WebDriverBy::id('to[time]_h'))->sendKeys("15");
self::$webDriver->findElement(WebDriverBy::id('to[time]_m'))->sendKeys("10");
self::$webDriver->findElement(WebDriverBy::name('cmd[saveEditBooking]'))->click();
$this->assertContains("Buchung erfolgreich bearbeitet", self::$helper->getSuccMessage());
self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Buchungen'))->click();
// check calendar for booking
self::$webDriver->findElement(WebDriverBy::linkText(self::$helper->getCurrentMonth() . ' ' . date('Y')))->click();
$this->assertContains("14:00 CalendarTestBooking", self::$webDriver->findElement(webDriverBy::cssSelector("div.ilTabContentOuter.ilTabsTableCell"))->getText());
// go back to bookings
self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
}
示例13: testValidBookingWithParticipants
/**
* Test valid booking: participants
* @test
*/
public function testValidBookingWithParticipants()
{
self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
self::$helper->fillBookingForm("Testbuchung", "12", "2", "2016", "10", "00", "12", "2", "2016", "11", "00", true, "", true, array("aaa", "bbb"));
self::$webDriver->findElement(WebDriverBy::name('cmd[book]'))->click();
$this->assertEquals("Buchung hinzugefügt", self::$helper->getSuccMessage());
$page = self::$webDriver->findElement(WebDriverBy::tagName('body'))->getText();
$this->assertContains("Alfred", $page);
$this->assertContains("Bernd", $page);
self::$helper->deleteFirstBooking();
}
示例14: tearDownAfterClass
/**
* Closes web browser.
*/
public static function tearDownAfterClass()
{
self::$helper->login(self::$login_user, self::$login_pass);
self::$helper->toRSS();
self::$helper->deleteAllRooms();
self::$webDriver->findElement(WebDriverBy::linkText('Privilegien'))->click();
self::$webDriver->findElement(WebDriverBy::partialLinkText(self::$classname))->click();
self::$webDriver->findElement(WebDriverBy::partialLinkText('Klasse löschen'))->click();
self::$webDriver->findElement(WebDriverBy::name('cmd[deleteClass]'))->click();
self::$helper->deleteOneAttributeForBooking();
self::$helper->deleteUser();
self::$helper->toRSS();
self::$helper->deleteUser();
self::$helper->logout();
self::$webDriver->quit();
}
示例15: getWebDriverLocator
protected function getWebDriverLocator(array $by)
{
$type = key($by);
$locator = $by[$type];
switch ($type) {
case 'id':
return \WebDriverBy::id($locator);
case 'name':
return \WebDriverBy::name($locator);
case 'css':
return \WebDriverBy::cssSelector($locator);
case 'xpath':
return \WebDriverBy::xpath($locator);
case 'link':
return \WebDriverBy::linkText($locator);
case 'class':
return \WebDriverBy::className($locator);
default:
throw new TestRuntime("Locator type '{$by}' is not defined. Use either: xpath, css, id, link, class, name");
}
}