Tabnine Logo
PageElement.javascript
Code IndexAdd Tabnine to your IDE (free)

How to use
javascript
method
in
com.atlassian.pageobjects.elements.PageElement

Best Java code snippets using com.atlassian.pageobjects.elements.PageElement.javascript (Showing top 20 results out of 315)

origin: com.atlassian.confluence/confluence-webdriver-pageobjects

public AvatarUploaderDialog uploadImage(File imageFile) {
  if (!imageFile.exists()) {
    throw new IllegalArgumentException("The image was not found in the path.");
  }
  // Can't use OS file picker with webdriver but we can type file path to the input
  // Hack: can't type to hidden inputs so we must show it first
  uploadFileField.javascript().execute("AJS.$(arguments[0]).show()");
  uploadFileField.type(imageFile.getAbsolutePath());
  return this;
}
origin: com.atlassian.applinks/applinks-pageobjects

  public <T> T execute(@Nonnull Class<T> expectedReturnType, @Nonnull String moduleId, @Nonnull String functionName,
             @Nonnull String... args) {
    checkNotNull(expectedReturnType, "expectedReturnType");

    String script = format("return require('%s').%s(%s)", moduleId, functionName, Joiner.on(',').join(args));
    return elementFinder.find(By.tagName(Elements.TAG_BODY)).javascript().execute(expectedReturnType, script);
  }
}
origin: com.atlassian.confluence/confluence-webdriver-pageobjects

public SpaceDetailsDialog uploadImage(File imageFile) {
  if (!imageFile.exists()) {
    throw new IllegalArgumentException("The image was not found in the path.");
  }
  // Can't use OS file picker with webdriver but we can type file path to the input
  // Hack: can't type to hidden inputs so we must show it first
  uploadFileField.javascript().execute("AJS.$(arguments[0]).show()");
  uploadFileField.type(imageFile.getAbsolutePath());
  return this;
}
origin: com.atlassian.plugins/atlassian-it-contract-plugin

private List<String> getContracts(String method)
{
  String contractsString = (String) testPage.getTestResult().javascript()
      .execute("return AJS.TestContractManager && AJS.TestContractManager." + method + "().join();");
  String[] contracts = contractsString == null ? new String[]{} : contractsString.split(",");
  return Lists.newArrayList(contracts);
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

/**
 * Focus on multi select, input some value and blur
 *
 * @param query input for multi select
 * @return this multi select instance
 */
public MultiSelect freeInput(CharSequence query)
{
  textArea.type(query);
  textArea.javascript().execute("arguments[0].blur()");
  return this;
}
origin: com.atlassian.plugins/atlassian-connect-integration-tests-support

public void deactivateDropDownIfPresent() {
  if (dropDownLinkId.isPresent()) {
    List<PageElement> elementList = elementFinder.findAll(By.id(dropDownLinkId.get()));
    if (elementList.size() > 0) {
      waitUntilTrue(elementList.get(0).timed().isVisible());
      if (elementList.get(0).hasClass("aui-dropdown2-active")) {
        elementList.get(0).javascript().mouse().click();
      }
    }
  }
}
origin: com.atlassian.plugins/atlassian-connect-server-integration-tests-support

public void deactivateDropDownIfPresent() {
  if (dropDownLinkId.isPresent()) {
    List<PageElement> elementList = elementFinder.findAll(By.id(dropDownLinkId.get()));
    if (elementList.size() > 0) {
      waitUntilTrue(elementList.get(0).timed().isVisible());
      if (elementList.get(0).hasClass("aui-dropdown2-active")) {
        elementList.get(0).javascript().mouse().click();
      }
    }
  }
}
origin: com.atlassian.applinks/applinks-pageobjects

private void whyIntegrationTestingSux() {
  // START HACK because WebDriver in its infinite wisdom thinks that the whole confirm dialog is not visible
  // (not that we are making it easy for WebDriver to figure out things, by opening a dialog inside
  // an iframe and what not)
  // it will not allow to click that freakin' button - obviously - because user couldn't click it. So
  // considerate of you WebDriver, thanks. We have to deal with this in a well-established way
  // of using Javascript to do the job (back to Selenium1, yaaay)
  confirmDeleteDialog.find(By.className("confirm")).javascript().execute("jQuery(arguments[0]).click();");
  // END HACK <crying>
}
origin: com.atlassian.applinks/applinks-pageobjects

public BasicAccessAuthenticationSection modifyAtlToken() {
  elementFinder.find(By.tagName(PageElements.BODY)).javascript()
      .execute("AJS.$('.auth-config input[name=\"atl_token\"]').val('hacker!')");
  return this;
}
origin: com.atlassian.applinks/applinks-pageobjects

/**
 * Executes JavaScript against the page, updating the 'atl_token' value for the form. This simulates a malicious
 * user attempting to hack the page.
 *
 * @return this
 */
public TrustedApplicationAuthenticationSection modifyAtlToken() {
  elementFinder.find(By.tagName(BODY)).javascript()
      .execute("AJS.$('.auth-config .edit input[name=\"atl_token\"]').val('hacker!')");
  return this;
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

  public DeleteCommentConfirmationDialog openDeleteDialog()
  {
    //Need to use JS because element is only visible on :hover
    item.find(By.className("delete-comment")).javascript().execute("AJS.$(arguments[0]).click();");
    return binder.bind(DeleteCommentConfirmationDialog.class, issueKey);
  }
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

public WatchersComponent removeWatcher(String watcher) {
  Tracer tracer = traceContext.checkpoint();
  // need to execute javascript because it is only visible on :hover
  watchersDialog.find(By.cssSelector("li[data-username=" + watcher + "] .item-delete")).javascript().execute("jQuery(arguments[0]).click()");
  traceContext.waitFor(tracer, "jira.issue.watcher.deleted");
  return this;
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

private WebElement getDragHandle(String tab)
{
  final PageElement tabEl = elementFinder.find(By.cssSelector(".menu-item[data-name='" + tab + "']"));
  tabEl.javascript().execute("jQuery(arguments[0]).addClass('wd-activate-hover')"); // hacking css :hover
  return driver.findElement(By.cssSelector(".menu-item[data-name='" + tab + "'] .tab-draghandle"));
}
origin: com.atlassian.confluence.plugins/confluence-create-content-test-support

public <T> T selectBlueprint(BlueprintDialog createDialog, Class<T> pageClass, String createDialogWebItemKey) {
  // blueprint may not be visible, we should first scroll it into view
  PageElement blueprint = finder.find(By.cssSelector("li[data-item-module-complete-key='" + createDialogWebItemKey + "']"));
  blueprint.javascript().execute("arguments[0].scrollIntoView(true);");
  createDialog.selectContentType(createDialogWebItemKey);
  return createDialog.waitForSubmitEnabledAndSubmit(pageClass);
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

private void preventTheEvil()
{
  // get out of any IFrame
  webDriver.switchTo().defaultContent();
  // just make it WOOOORK
  finder.find(body()).javascript().execute("window.onbeforeunload=null;");
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

  private PageElement openIssueActionsMenu()
  {
    PageElement issueActionsTrigger = issue.find(By.className("issue-actions-trigger"));

    // HACK: Button appears on mouseover, which fails in webdriver, so use javascript to make element appear and be clickable
    issueActionsTrigger.javascript().execute("AJS.$(arguments[0]).addClass('active');");
    Poller.waitUntilTrue("Issue actions trigger is not visible.", issueActionsTrigger.timed().isVisible());

    issueActionsTrigger.click();

    return finder.find(By.id("actions_" + id + "_drop"));
  }
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

public ViewIssuePage confirm()
{
  PageElement deleteButton = locator.find(By.id("comment-delete-submit"));
  deleteButton.javascript().execute("AJS.$('#" + DIALOG_ELEMENT_ID + "').addClass('" + DIRTY_FLAG_CLASS + "');");
  Tracer tracer = traceContext.checkpoint();
  deleteButton.click();
  Poller.waitUntilFalse(dialog.timed().hasClass(DIRTY_FLAG_CLASS));
  ViewIssuePage viewIssuePage = pageBinder.bind(ViewIssuePage.class, issueKey);
  return viewIssuePage.waitForAjaxRefresh(tracer);
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

public EditScreenTab removeField(String field)
{
  final PageElement row = findRow(field);
  row.javascript().execute("jQuery(arguments[0]).addClass('active')"); // hacking css :hover
  row.find(By.className("aui-restfultable-delete")).click();
  Poller.waitUntilFalse(hasField(field));
  return this;
}
origin: com.atlassian.jira.plugins/jira-dvcs-connector-pageobjects

public void sync() {
  rootElement.javascript().mouse().mouseover();
  final PageElement syncIcon = getSyncIcon();
  waitUntilTrue(syncIcon.timed().isPresent());
  TimedQuery<Long> lastSync = Queries.forSupplier(timeouts,
      () -> NumberUtils.toLong(syncIcon.getAttribute("data-last-sync")), TimeoutType.SLOW_PAGE_LOAD);
  final long lastSyncBefore = lastSync.now();
  syncIcon.javascript().mouse().click();
  waitUntil(lastSync, greaterThan(lastSyncBefore));
  waitUntilFalse(syncIcon.withTimeout(TimeoutType.SLOW_PAGE_LOAD).timed().hasClass("running"));
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

@WaitUntil
public void isAt()
{
  // TODO wrong place to initialize stuff
  table = elementFinder.find(By.id("tab-" + tabId));
  Poller.waitUntilTrue(table.timed().isPresent());
  Poller.waitUntilFalse(table.timed().hasClass("loading"));
  fieldPicker = pageBinder.bind(SingleSelect.class, elementFinder.find(By.className("available-fields")));
  tab = elementFinder.find(By.cssSelector(".menu-item[data-tab='" + tabId + "']"));
  tab.javascript().execute("jQuery(arguments[0]).addClass('wd-activate-hover')");
  deleteTab = tab.find(By.className("delete-tab"));
}
com.atlassian.pageobjects.elementsPageElementjavascript

Popular methods of PageElement

  • timed
  • click
  • getAttribute
  • find
  • getText
  • isPresent
  • type
  • isVisible
  • clear
  • getValue
  • findAll
  • isSelected
  • findAll,
  • isSelected,
  • select,
  • withTimeout,
  • hasAttribute,
  • hasClass,
  • getSize,
  • getTagName,
  • isEnabled

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getExternalFilesDir (Context)
  • getApplicationContext (Context)
  • Path (java.nio.file)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JTextField (javax.swing)
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now