Beispiel #1
0
 public void reload() {
   if (devType.equals("tablet")) {
     Element reloadBtn = mDriver.findElement(getActivity(), R.id.reload);
     reloadBtn.click();
   } else {
     mActions.sendSpecialKey(Actions.SpecialKey.MENU);
     waitForText("^New Tab$");
     if (!osVersion.equals("2.x")) {
       Element reloadBtn = mDriver.findElement(getActivity(), R.id.reload);
       reloadBtn.click();
     } else {
       mSolo.clickOnText("^Reload$");
     }
     ensureMenuClosed();
   }
 }
 public Select getSelectLambda(Supplier<By> by) {
   Element element = untilFound(by);
   new WebDriverWait(this, 3, 100)
       .until(
           (WebDriver driver) -> {
             element.click();
             return !element.findElements(By.tagName("option")).isEmpty();
           });
   return new Select(element);
 }
 public Select getSelect(Supplier<By> by) {
   final Element element = untilFound(by);
   new WebDriverWait(this, 3, 100)
       .until(
           (Predicate<WebDriver>)
               driver -> {
                 element.click();
                 return !element.findElements(By.tagName("option")).isEmpty();
               });
   return new Select(element);
 }
Beispiel #4
0
    public void forward() {
      Actions.EventExpecter pageShowExpecter = mActions.expectGeckoEvent("Content:PageShow");

      if (devType.equals("tablet")) {
        Element fwdBtn = mDriver.findElement(getActivity(), R.id.forward);
        fwdBtn.click();
      } else {
        mActions.sendSpecialKey(Actions.SpecialKey.MENU);
        waitForText("^New Tab$");
        if (!osVersion.equals("2.x")) {
          Element fwdBtn = mDriver.findElement(getActivity(), R.id.forward);
          fwdBtn.click();
        } else {
          mSolo.clickOnText("^Forward$");
        }
        ensureMenuClosed();
      }

      pageShowExpecter.blockForEvent();
      pageShowExpecter.unregisterListener();
    }
Beispiel #5
0
    public void back() {
      Actions.EventExpecter pageShowExpecter = mActions.expectGeckoEvent("Content:PageShow");

      if (devType.equals("tablet")) {
        Element backBtn = mDriver.findElement(getActivity(), R.id.back);
        backBtn.click();
      } else {
        mActions.sendSpecialKey(Actions.SpecialKey.BACK);
      }

      pageShowExpecter.blockForEvent();
      pageShowExpecter.unregisterListener();
    }
Beispiel #6
0
 // DEPRECATED!
 // Use BaseTest.toggleBookmark() in new code.
 public void bookmark() {
   mActions.sendSpecialKey(Actions.SpecialKey.MENU);
   waitForText("^New Tab$");
   if (mSolo.searchText("^Bookmark$")) {
     // This is the Android 2.x so the button has text
     mSolo.clickOnText("^Bookmark$");
   } else {
     Element bookmarkBtn = mDriver.findElement(getActivity(), R.id.bookmark);
     if (bookmarkBtn != null) {
       // We are on Android 4.x so the button is an image button
       bookmarkBtn.click();
     }
   }
   ensureMenuClosed();
 }
Beispiel #7
0
 /**
  * Gets the AdapterView of the tabs list.
  *
  * @return List view in the tabs tray
  */
 private final AdapterView<ListAdapter> getTabsList() {
   Element tabs = mDriver.findElement(getActivity(), R.id.tabs);
   tabs.click();
   return (AdapterView<ListAdapter>) getActivity().findViewById(R.id.normal_tabs);
 }
Beispiel #8
0
 public void setCheckboxValue(Supplier<By> by, boolean value) {
   Element checkbox = untilFound(by);
   if (checkbox.isSelected() != value) {
     checkbox.click();
   }
 }