本文整理汇总了PHP中WebDriverBy::id方法的典型用法代码示例。如果您正苦于以下问题:PHP WebDriverBy::id方法的具体用法?PHP WebDriverBy::id怎么用?PHP WebDriverBy::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebDriverBy
的用法示例。
在下文中一共展示了WebDriverBy::id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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');
}
示例4: 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()
);
}
示例5: 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());
}
示例6: 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'));
}
示例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');
}
示例8: 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);
}
示例9: testLoadsWithPermission
/**
* Tests that the page does not load if the user does not have correct
* permissions
*
* @return void
*/
function testLoadsWithPermission()
{
$this->setupPermissions(array("training"));
$this->safeGet($this->url . "/training/");
$bodyText = $this->webDriver->findElement(WebDriverBy::id("training-options"))->getText();
$this->assertContains("training", $bodyText);
$this->resetPermissions();
}
示例10: __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_img_lg')));
$this->products = $this->web_driver->findElements(WebDriverBy::cssSelector("a.pname_list"));
}
示例11: login
public function login($user, $pass)
{
$this->driver->get($this->url);
$this->driver->findElement(WebDriverBy::id("usuariologin"))->sendKeys("teste");
$this->driver->findElement(WebDriverBy::id("usuariosenha"))->sendKeys("123");
$this->driver->findElement(WebDriverBy::tagName("button"))->click();
$this->assertEquals("Administração QuickLoja", $this->driver->getTitle());
return $this->driver;
}
示例12: loginToGoo
public static function loginToGoo($driver, $goo_id, $password)
{
require ROOT . '/tests/config.php';
$driver->get('https://login.mail.goo.ne.jp/id/authn/LoginStart');
$driver->findElement(\WebDriverBy::id('uname'))->sendKeys($goo_id);
$element = $driver->findElement(\WebDriverBy::id('pass'));
$element = $element->sendKeys($password);
$element->submit();
}
示例13:
/**
* @test
*/
public function gooIDログインする()
{
require ROOT . '/tests/config.php';
$driver = Util::createSmartPhoneUaDriver();
$driver->get('https://login.mail.goo.ne.jp/id/authn/LoginStart');
$driver->findElement(\WebDriverBy::id('uname'))->sendKeys($gooid_user);
$element = $driver->findElement(\WebDriverBy::id('pass'));
$element = $element->sendKeys($gooid_pass);
$element->submit();
}
示例14: __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'));
}
示例15: testShouldPersistSizes
public function testShouldPersistSizes()
{
$element = self::$driver->findElement(WebDriverBy::id('tinypng_sizes_medium'));
$element->click();
self::$driver->findElement(WebDriverBy::tagName('form'))->submit();
$elements = self::$driver->findElements(WebDriverBy::xpath('//input[@type="checkbox" and starts-with(@name, "tinypng_sizes") and @checked="checked"]'));
$size_ids = array_map('elementName', $elements);
$this->assertContains('tinypng_sizes[thumbnail]', $size_ids);
$this->assertNotContains('tinypng_sizes[medium]', $size_ids);
$this->assertContains('tinypng_sizes[large]', $size_ids);
}