org.xwiki.test.ui.XWikiWebDriver.findElement()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.xwiki.test.ui.XWikiWebDriver.findElement()方法的一些代码示例,展示了XWikiWebDriver.findElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWikiWebDriver.findElement()方法的具体详情如下:
包路径:org.xwiki.test.ui.XWikiWebDriver
类名称:XWikiWebDriver
方法名:findElement

XWikiWebDriver.findElement介绍

[英]Same as #findElement(By) but don't scroll to make the element visible. Useful for example when verifying that the page has finished loading (and thus there's no element visible and we cannot scroll to it).
[中]与#findElement(By)相同,但不要滚动以使元素可见。例如,在验证页面已完成加载(因此没有可见的元素,我们无法滚动到它)时非常有用。

代码示例

代码示例来源:origin: org.phenotips/patient-data-pageobjects

public boolean checkIfClinicalSymptomsAndPhysicalFindingsExpanded(By by)
{
  try {
    getDriver().findElement(By.id("PhenoTips.PatientClass_0_unaffected"));
    return true;
  } catch (NoSuchElementException e) {
    return false;
  }
}

代码示例来源:origin: phenotips/phenotips

public boolean checkIfClinicalSymptomsAndPhysicalFindingsExpanded(By by)
{
  try {
    getDriver().findElement(By.id("PhenoTips.PatientClass_0_unaffected"));
    return true;
  } catch (NoSuchElementException e) {
    return false;
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

/**
 * @since 7.0RC1
 */
private void clickSubMenuEntryFromMenu(By menuBy, String id)
{
  // Open the parent Menu
  getDriver().findElement(menuBy).click();
  // Wait for the submenu entry to be visible
  getDriver().waitUntilElementIsVisible(By.id(id));
  // Click on the specified entry
  getDriver().findElement(By.id(id)).click();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

/**
 * Gets a string representation of the URL for editing the page.
 */
public String getEditURL()
{
  return getDriver().findElement(By.xpath("//div[@id='tmEdit']//a")).getAttribute("href");
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

public AttachmentsPane openAttachmentsDocExtraPane()
{
  getDriver().findElement(By.id("Attachmentslink")).click();
  waitForDocExtraPaneActive("attachments");
  return new AttachmentsPane();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

/**
 * @since 3.2M3
 */
public WebElement getAttachmentLink(String attachmentName)
{
  return getDriver().findElement(
    By.xpath("//div[@id='_attachments']//a[@title = 'Download this attachment' and contains(@href, '"
      + attachmentName + "')]"));
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-flamingo-theme-test-pageobjects

public void setVariableValue(String variableName, String value)
{
  WebElement variableField = getDriver().findElement(By.xpath("//label[text() = '@"+variableName+"']/..//input"));
  // Remove the previous value
  variableField.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.BACK_SPACE);
  // Write the new one
  variableField.sendKeys(value);
}

代码示例来源:origin: phenotips/phenotips

public boolean checkSmithLemliSyndrome()
{
  this.getDriver().waitUntilElementIsVisible(By.id("result__270400"));
  try {
    getDriver().findElement(By.id("result__270400"));
    return true;
  } catch (NoSuchElementException e) {
    return false;
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

public BaseModal(By selector)
{
  this.container = getDriver().findElement(selector);
  // The fade effect is deleted from the modal because there isn't an easy way for waiting on the modal to be
  // shown. This fade in effect is also not necessary for the test.
  String className = this.container.getAttribute("class");
  className = className.replace("fade", "");
  getDriver().executeScript("arguments[0].setAttribute(\"class\",arguments[1])", this.container, className);
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

private void recacheSecretTokenWhenOnRegisterPage()
{
  try {
    WebElement tokenInput = getDriver().findElement(By.xpath("//input[@name='form_token']"));
    this.secretToken = tokenInput.getAttribute("value");
  } catch (NoSuchElementException exception) {
    // Something is really wrong if this happens.
    System.out.println("Warning: Failed to cache anti-CSRF secret token, some tests might fail!");
    exception.printStackTrace();
  }
}

代码示例来源:origin: org.phenotips/patient-data-pageobjects

public void browseRelatedTermsCataract()
{
  this.getDriver()
    .findElement(
      By.xpath(
        "//*[contains(@class, 'suggestItems')]//*[contains(@class, 'suggestItem')][//*[text() = 'Cataract']]//*[contains(@class, 'xHelpButton')]"))
    .click();
  this.getDriver().waitUntilElementIsVisible(By
    .xpath(
      "//*[@class = 'resultContainer']//li[contains(@class, 'xitem')]//*[contains(@class, 'xTooltip')]//*[contains(text(), 'Browse related terms')]"));
  this.browseRelatedTermsCataract.click();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

public void deleteProperty(String propertyName)
{
  final By propertyLocator = By.id("xproperty_" + propertyName);
  final WebElement propertyContainer = getDriver().findElement(propertyLocator);
  WebElement deleteLink = propertyContainer.findElement(By.className("delete"));
  deleteLink.click();
  // Expect a confirmation box
  getDriver().waitUntilElementIsVisible(By.className("xdialog-box-confirmation"));
  getDriver().findElement(By.cssSelector(".xdialog-box-confirmation input[value='Yes']")).click();
  getDriver().waitUntilElementDisappears(propertyLocator);
}

代码示例来源:origin: phenotips/phenotips

public void hoverOverClinicalSymptoms()
{
  new Actions(getDriver()).moveToElement(getDriver().findElement(By.id("HClinicalsymptomsandphysicalfindings")))
    .perform();
}

代码示例来源:origin: org.phenotips/patient-data-pageobjects

public void hoverOverClinicalSymptoms()
{
  new Actions(getDriver()).moveToElement(getDriver().findElement(By.id("HClinicalsymptomsandphysicalfindings")))
    .perform();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

/**
 * @since 4.3M2
 */
public void deleteObject(By objectLocator)
{
  final WebElement objectContainer = getDriver().findElement(objectLocator);
  WebElement deleteLink = objectContainer.findElement(By.className("delete"));
  deleteLink.click();
  // Expect a confirmation box
  getDriver().waitUntilElementIsVisible(By.className("xdialog-box-confirmation"));
  getDriver().findElement(By.cssSelector(".xdialog-box-confirmation input[value='Yes']")).click();
  getDriver().waitUntilElementDisappears(objectLocator);
}

代码示例来源:origin: phenotips/phenotips

public void hoverOverPrenatalHistory()
{
  new Actions(getDriver()).moveToElement(getDriver().findElement(By.id("HPrenatalandperinatalhistory")))
    .perform();
}

代码示例来源:origin: org.phenotips/patient-data-pageobjects

public boolean checkAllPhenotypesCollapsed()
{
  this.getDriver().waitUntilElementDisappears(
    By.cssSelector("label[for='PhenoTips.PatientClass_0_phenotype_HP:0001363]"));
  try {
    getDriver().findElement(By.cssSelector("label[for='PhenoTips.PatientClass_0_phenotype_HP:0001363]"));
    return true;
  } catch (NoSuchElementException e) {
    return false;
  }
}

代码示例来源:origin: org.phenotips/patient-data-pageobjects

public void hoverOverPatientInformation()
{
  new Actions(getDriver()).moveToElement(
    getDriver().findElement(By.xpath("//*[contains(@class, 'patient-info')]"))).perform();
}

代码示例来源:origin: org.phenotips/patient-data-pageobjects

public void hoverOverMeasurements()
{
  new Actions(getDriver()).moveToElement(
    getDriver().findElement(By.xpath("//*[contains(@class, 'measurement-info')]"))).perform();
}

代码示例来源:origin: phenotips/phenotips

public void hoverOverMeasurements()
{
  new Actions(getDriver()).moveToElement(
    getDriver().findElement(By.xpath("//*[contains(@class, 'measurement-info')]"))).perform();
}

相关文章