本文整理汇总了PHP中Facebook\WebDriver\WebDriverBy::tagName方法的典型用法代码示例。如果您正苦于以下问题:PHP WebDriverBy::tagName方法的具体用法?PHP WebDriverBy::tagName怎么用?PHP WebDriverBy::tagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook\WebDriver\WebDriverBy
的用法示例。
在下文中一共展示了WebDriverBy::tagName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fillRteEditor
/**
* @param $selector
* @param $content
*/
private function fillRteEditor($selector, $content)
{
$this->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver) use($selector, $content) {
$webDriver->switchTo()->frame($webDriver->findElement($selector));
$webDriver->executeScript('arguments[0].innerHTML = "' . addslashes($content) . '"', [$webDriver->findElement(\Facebook\WebDriver\WebDriverBy::tagName('body'))]);
$webDriver->switchTo()->defaultContent();
});
}
示例2: doSelectOption
function doSelectOption($location, $displayedValue)
{
$select = $this->webDriver->findElement($location);
$options = $select->findElements(WebDriverBy::tagName('option'));
$wasFound = 0;
foreach ($options as $option) {
if ($displayedValue === $option->getText()) {
$option->click();
$wasFound = 1;
}
}
$this->assertEquals(1, $wasFound);
}
示例3: testAddVCFFileToCMTIndividual
public function testAddVCFFileToCMTIndividual()
{
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000002$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr[2]/td[2]"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*Are you sure you are done with submitting the variants found with this screening[\\s\\S][\\s\\S]*$/', $this->getConfirmation()));
$this->chooseOkOnNextConfirmation();
$element = $this->driver->findElement(WebDriverBy::xpath("//tr[3]/td[2]/b"));
$element->click();
// $element = $this->driver->findElement(WebDriverBy::cssSelector("#0000000002 > td.ordered"));
$element = $this->driver->findElement(WebDriverBy::xpath("//td[text()='0000000002']"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create&target=0000000002$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//tr[3]/td[2]/b"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create&target=0000000002$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create&type=VCF&target=0000000002$/', $this->driver->getCurrentURL()));
$this->enterValue(WebDriverBy::name("variant_file"), ROOT_PATH . "../tests/test_data_files/ShortVCFfilev1.vcf");
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="hg_build"]/option[text()="hg19"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="dbSNP_column"]/option[text()="VariantOnGenome/Reference"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="genotype_field"]/option[text()="Use Phred-scaled genotype likelihoods (PL)"]'));
$option->click();
$this->check(WebDriverBy::name("allow_mapping"));
$this->check(WebDriverBy::name("allow_create_genes"));
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="owned_by"]/option[text()="LOVD3 Admin"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="statusid"]/option[text()="Public"]'));
$option->click();
$element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Upload VCF file']"));
$element->click();
$this->assertEquals("25 variants were imported, 1 variant could not be imported.", $this->driver->findElement(WebDriverBy::id("lovd__progress_message"))->getText());
$element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000002$/', $this->driver->getCurrentURL()));
for ($second = 0;; $second++) {
if ($second >= 600) {
$this->fail("timeout");
}
$this->driver->get(ROOT_URL . "/src/ajax/map_variants.php");
if (strcmp("0 99 There are no variants to map in the database", $this->driver->findElement(WebDriverBy::tagName("body"))->getText())) {
break;
}
$this->assertNotContains("of 25 variants", $this->driver->findElement(WebDriverBy::tagName("body"))->getText());
sleep(1);
}
}
示例4: testAddSummaryVariantVCFFile
public function testAddSummaryVariantVCFFile()
{
// Mouse hover over Submit tab, to make 'submit new data' link visible.
$tabElement = $this->driver->findElement(WebDriverBy::xpath("//img[@id='tab_submit']"));
$this->driver->getMouse()->mouseMove($tabElement->getCoordinates());
$element = $this->driver->findElement(WebDriverBy::linkText("Submit new data"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr[2]/td[2]/b"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*Please reconsider to submit individual data as well, as it makes the data you submit much more valuable![\\s\\S]*$/', $this->getConfirmation()));
$this->chooseOkOnNextConfirmation();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//tr[3]/td[2]/b"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
$element->click();
$this->driver->get(ROOT_URL . "/src/variants/upload?create&type=VCF");
$this->enterValue(WebDriverBy::name("variant_file"), ROOT_PATH . "../tests/test_data_files/ShortVCFfilev1.vcf");
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="hg_build"]/option[text()="hg19"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="dbSNP_column"]/option[text()="VariantOnGenome/Reference"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="genotype_field"]/option[text()="Use Phred-scaled genotype likelihoods (PL)"]'));
$option->click();
$this->check(WebDriverBy::name("allow_mapping"));
$this->check(WebDriverBy::name("allow_create_genes"));
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="owned_by"]/option[text()="LOVD3 Admin"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="statusid"]/option[text()="Public"]'));
$option->click();
$element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Upload VCF file']"));
$element->click();
$this->assertEquals("25 variants were imported, 1 variant could not be imported.", $this->driver->findElement(WebDriverBy::id("lovd__progress_message"))->getText());
$element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
$element->click();
$this->assertTrue((bool) preg_match('/^Successfully processed your submission and sent an email notification to the relevant curator[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText()));
for ($second = 0;; $second++) {
if ($second >= 600) {
$this->fail("timeout");
}
$this->driver->get(ROOT_URL . "/src/ajax/map_variants.php");
if (strcmp("0 99 There are no variants to map in the database", $this->driver->findElement(WebDriverBy::tagName("body"))->getText())) {
break;
}
$this->assertNotContains("of 25 variants", $this->driver->findElement(WebDriverBy::tagName("body"))->getText());
sleep(1);
}
}
示例5: captcha
private function captcha()
{
$path = \Yii::getAlias('@runtime/tmp') . '/' . time() . '_' . rand() . '.png';
$this->driver->takeScreenshot($path);
$coordinates = $this->driver->findElement(WebDriverBy::tagName('img'))->getCoordinates()->onPage();
if (Image::crop($path, $coordinates->getX(), $coordinates->getY(), 130, 50)) {
if (\Yii::$app->get('captcha')->run($path)) {
$this->driver->findElement(WebDriverBy::xpath('//input[@name=\'captcha_key\']'))->click();
$this->driver->findElement(WebDriverBy::xpath('//input[@name=\'captcha_key\']'))->sendKeys(\Yii::$app->get('captcha')->result());
}
} else {
throw new Exception('Проблема при обрезании картинки');
}
}
示例6: testAddVCFFileToIVAIndividual
public function testAddVCFFileToIVAIndividual()
{
// wait for page redirect
$this->waitUntil(WebDriverExpectedCondition::titleContains("Submission of"));
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000003$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create&target=0000000003$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//tr[3]/td[2]/b"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create&target=0000000003$/', $this->driver->getCurrentURL()));
$element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
$element->click();
$this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create&type=VCF&target=0000000003$/', $this->driver->getCurrentURL()));
$this->enterValue(WebDriverBy::name("variant_file"), ROOT_PATH . "../tests/test_data_files/ShortVCFfilev1.vcf");
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="hg_build"]/option[text()="hg19"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="dbSNP_column"]/option[text()="VariantOnGenome/Reference"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="genotype_field"]/option[text()="Use Phred-scaled genotype likelihoods (PL)"]'));
$option->click();
$this->check(WebDriverBy::name("allow_mapping"));
$this->check(WebDriverBy::name("allow_create_genes"));
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="owned_by"]/option[text()="LOVD3 Admin"]'));
$option->click();
$option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="statusid"]/option[text()="Public"]'));
$option->click();
$element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Upload VCF file']"));
$element->click();
$this->assertEquals("25 variants were imported, 1 variant could not be imported.", $this->driver->findElement(WebDriverBy::id("lovd__progress_message"))->getText());
$element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
$element->click();
for ($second = 0;; $second++) {
if ($second >= 600) {
$this->fail("timeout");
}
$this->driver->get(ROOT_URL . "/src/ajax/map_variants.php");
if (strcmp("0 99 There are no variants to map in the database", $this->driver->findElement(WebDriverBy::tagName("body"))->getText())) {
break;
}
$this->assertNotContains("of 25 variants", $this->driver->findElement(WebDriverBy::tagName("body"))->getText());
sleep(1);
}
// Test whether a variant was parsed correctly via mutalyzer.
$this->driver->get(ROOT_URL . '/src/genes/ARSD');
$element = $this->driver->findElement(WebDriverBy::xpath('//tr[@class="data"]/td[text()="X"]'));
$element->click();
$this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath('//td[text()="p.(Gln318His)"]')));
}
示例7: test_permission_roles
public function test_permission_roles()
{
$this->login();
$this->admin_login();
$this->add_lang('acp/permissions');
$this->visit('adm/index.php?i=acp_permissions&mode=setting_forum_local&sid=' . $this->sid);
// Select forums
$elements = self::find_element('cssSelector', 'select#forum')->findElements(\Facebook\WebDriver\WebDriverBy::tagName('option'));
foreach ($elements as $element) {
$element->click();
}
self::find_element('cssSelector', 'form#select_victim')->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=submit]'))->click();
// Select administrators and guests
$groups_form = self::find_element('cssSelector', 'form#groups');
$elements = $groups_form->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('select'))->findElements(\Facebook\WebDriver\WebDriverBy::tagName('option'));
foreach ($elements as $element) {
if ($element->getText() === 'Administrators' || $element->getText() === 'Guests') {
$element->click();
}
}
$groups_form->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[name=submit_edit_options]'))->click();
$first_fieldset = self::find_element('cssSelector', '#perm11');
$this->assertEquals('none', $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
$first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->click();
$this->assertEquals('block', $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
$lis = $first_fieldset->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('ul > li'));
foreach ($lis as $li) {
if ($li->getAttribute('data-id') == 18) {
$li->click();
break;
}
}
$this->assertEquals('none', $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
$this->assertEquals(18, $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value'));
$this->assertEquals($this->lang('ROLE_FORUM_LIMITED'), $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText());
// Check that admin settings didn't get changed
$second_fieldset = self::find_element('cssSelector', '#perm10');
$this->assertEquals('none', $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
// Full access = 14
$this->assertEquals(14, $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value'));
$this->assertEquals($this->lang('ROLE_FORUM_FULL'), $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText());
// Check that category settings were not modified
$category_fieldset = self::find_element('cssSelector', '#perm00');
$this->assertEquals('none', $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
// No settings
$this->assertEquals('', $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value'));
$this->assertEquals($this->lang('NO_ROLE_ASSIGNED'), $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText());
}
示例8: testSetUserAgent
/**
* Set user agent
*/
public function testSetUserAgent()
{
$useragent = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16';
// setup
$capabilities = DesiredCapabilities::firefox();
/** @var FirefoxProfile $profile */
$profile = $capabilities->getCapability(FirefoxDriver::PROFILE);
$profile->setPreference('general.useragent.override', $useragent);
$this->webDriver = RemoteWebDriver::create('http://' . self::HOST . '/wd/hub', $capabilities);
// test
$this->webDriver->get('http://demo.mobiledetect.net/');
$elements = $this->webDriver->findElements(WebDriverBy::tagName('h1'));
static::assertEquals(3, count($elements));
$elementContainingQuestion = $elements[1];
static::assertEquals('Is your device really a phone?', $elementContainingQuestion->getText());
$this->webDriver->quit();
}
示例9: testChangeGroupMembership
public function testChangeGroupMembership()
{
$this->getUsers()[0]->findElement(WebDriverBy::tagName("a"))->click();
$this->waitForAlert();
$this->webDriver->switchTo()->alert()->dismiss();
$this->assertCount(2, $this->getUsers());
$this->getUsers()[0]->findElement(WebDriverBy::tagName("a"))->click();
$this->waitForAlert();
$this->webDriver->switchTo()->alert()->accept();
$this->waitForLoadingAnimation();
$this->assertCount(1, $this->getUsers());
$this->webDriver->findElement(WebDriverBy::cssSelector("ul.users li:last-child a:nth-child(2)"))->click();
$this->waitForAlert();
$this->webDriver->switchTo()->alert()->dismiss();
$this->assertCount(1, $this->getUsers());
$this->webDriver->findElement(WebDriverBy::cssSelector("ul.users li:last-child a:nth-child(2)"))->click();
$this->waitForAlert();
$this->webDriver->switchTo()->alert()->sendKeys(UserFixtures::$users['user-1']->getEmail());
$this->webDriver->switchTo()->alert()->accept();
$this->waitForLoadingAnimation();
$this->assertCount(2, $this->getUsers());
}
示例10: testSorting
public function testSorting()
{
$this->loginAndWait()->repopulateList();
// Confirm that we can't sort in Queue screen
/** @var WebDriverElement $th */
foreach ($this->els('#queueWrapper div.song-list-wrap th') as $th) {
if (!$th->isDisplayed()) {
continue;
}
foreach ($th->findElements(WebDriverBy::tagName('i')) as $sortDirectionIcon) {
static::assertFalse($sortDirectionIcon->isDisplayed());
}
}
// Now go to All Songs screen and sort there
$this->goto('songs')->click('#songsWrapper div.song-list-wrap th:nth-child(2)');
$last = null;
$results = [];
/** @var WebDriverElement $td */
foreach ($this->els('#songsWrapper div.song-list-wrap td.title') as $td) {
$current = $td->getText();
$results[] = $last === null ? true : $current <= $last;
$last = $current;
}
static::assertNotContains(false, $results);
// Second click will reverse the sort
$this->click('#songsWrapper div.song-list-wrap th:nth-child(2)');
$last = null;
$results = [];
/** @var WebDriverElement $td */
foreach ($this->els('#songsWrapper div.song-list-wrap td.title') as $td) {
$current = $td->getText();
$results[] = $last === null ? true : $current >= $last;
$last = $current;
}
static::assertNotContains(false, $results);
}
示例11: getDeviceInfo
public function getDeviceInfo()
{
//Заходим на страницу железки
$this->driver->get("http://{$this->user}:{$this->password}@{$this->host}");
//Собираем строки из таблицы
$infoRows = $this->driver->findElement(WebDriverBy::id('Status'))->findElements(WebDriverBy::tagName('tr'));
$result = [];
foreach ($infoRows as $infoRow) {
//Выбираем из строки ячейки
$tds = [];
foreach ($infoRow->findElements(WebDriverBy::tagName('td')) as $td) {
$tds[] = $td->getText();
}
//Разбираем данные
foreach ($tds as $tdIndex => $td) {
switch ($td) {
case 'Serial Number:':
$result['serialNumber'] = $tds[$tdIndex + 1];
break;
}
}
}
return $result;
}
示例12: getOptions
/**
* @return WebDriverElement[] All options belonging to this select tag.
*/
public function getOptions()
{
return $this->element->findElements(WebDriverBy::tagName('option'));
}
示例13: getArrayByTagName
/**
* Returns an element by the given tag name.
* If nothing is found, an empty array will be returned.
*
* @param string $tagName Tag name of expected element.
* @param int $attempts Attempts until the method will fail and return false.
*
* @return WebDriverElement[]|array
*/
public function getArrayByTagName($tagName, $attempts = 2)
{
if ($this->isFailed()) {
return [];
}
$by = WebDriverBy::tagName($tagName);
return $this->getArrayBy($by, $attempts);
}
示例14: expectsToBeSelectedByTagName
/**
* Client expects that an element is selected by the given tag name.
* Returns true when the element is selected and false otherwise.
* Retry the process two times or until the attempts argument count
* is reached when a stale element reference exception is thrown.
* Recommended usage in web driver waits.
*
* @param string $tagName Tag name of expected element.
* @param int $attempts (Optional) Attempts until the method will fail and return false.
*
* @return bool
*/
public function expectsToBeSelectedByTagName($tagName, $attempts = 2)
{
if ($this->isFailed()) {
return false;
}
$by = WebDriverBy::tagName($tagName);
return $this->expectsToBeSelected($by, $attempts);
}
示例15: getVlans
/**
* Получить спискок VLAN-ов
*/
public function getVlans()
{
//Заходим на страницу с таблицей вланов
$this->driver->get("http://{$this->host}/H_21_1QVLAN_Asy_table.htm");
//Выбираем строки в таблице
$vlanTableRows = $this->driver->findElement(WebDriverBy::id('mainGray'))->findElements(WebDriverBy::tagName('tr'));
//Первая строка - шапка - она нас не интересует
array_shift($vlanTableRows);
$results = [];
foreach ($vlanTableRows as $vlanTableRow) {
$tds = $vlanTableRow->findElements(WebDriverBy::tagName('td'));
$vlanId = $tds[0]->getText();
//Имя влана лежит в инпуте
$vlanName = $tds[1]->findElement(WebDriverBy::id('VlanName'))->getAttribute('value');
$vlanUntagedPorts = $tds[2]->getText();
$vlanTaggedPorts = $tds[3]->getText();
//Очищаем строки от знаков переноса
$vlanUntagedPorts = str_replace("\n", "", $vlanUntagedPorts);
$vlanTaggedPorts = str_replace("\n", "", $vlanTaggedPorts);
//Разибваем строку с портами в массив
$vlanUntagedPorts = explode(",", $vlanUntagedPorts);
$vlanTaggedPorts = explode(",", $vlanTaggedPorts);
$results[$vlanId] = ['name' => $vlanName, 'ports' => ['untagged' => $vlanUntagedPorts, 'tagged' => $vlanTaggedPorts]];
}
return $results;
}