コード例 #1
0
ファイル: EbselenCommands.java プロジェクト: windsoul/Ebselen
 public void uncheck(String locator) {
   WebElement checkBox = driver.findElement(loc.autoLocator(locator));
   if (!checkBox.getAttribute("type").toLowerCase().equals("checkbox")) {
     throw new InvalidElementTypeException("This elementLocator is not a checkbox!");
   }
   if (checkBox.isSelected()) {
     checkBox.click();
   }
 }
コード例 #2
0
ファイル: EbselenCommands.java プロジェクト: windsoul/Ebselen
 public boolean isChecked(String locator) {
   WebElement checkBox = driver.findElement(loc.autoLocator(locator));
   if (!checkBox.getAttribute("type").toLowerCase().equals("checkbox")) {
     throw new InvalidElementTypeException("This elementLocator is not a checkbox!");
   }
   if (checkBox.getAttribute("checked").equals("checked")) {
     return true;
   } else {
     return false;
   }
 }
コード例 #3
0
ファイル: EbselenCommands.java プロジェクト: windsoul/Ebselen
 /**
  * Open site homepage and check that it has loaded correctly. This will set the currently selected
  * site to the value of page
  *
  * @param homepageURL URL of the homepage
  * @param homePageElement If homePageElement is not null kill tests if it does not exist
  */
 public void openHomepage(String homepageURL, WebElement homePageElement) throws Exception {
   driver.get(homepageURL);
   if (homePageElement != null) {
     if (!homePageElement.isDisplayed()) {
       throw new HomepageNotLoadedException();
     }
   }
 }
コード例 #4
0
ファイル: EbselenCommands.java プロジェクト: windsoul/Ebselen
 /**
  * Find out if an element is stale or not.
  *
  * @param element - An xpath locator
  * @return boolean - True if element location is found, otherwise false.
  * @throws Exception
  */
 public boolean isElementStale(WebElement element) {
   try {
     element.getLocation();
   } catch (StaleElementReferenceException Ex) {
     return true;
   }
   return false;
 }