Codota Logo
Actions.click
Code IndexAdd Codota to your IDE (free)

How to use
click
method
in
org.openqa.selenium.interactions.Actions

Best Java code snippets using org.openqa.selenium.interactions.Actions.click (Showing top 20 results out of 387)

  • Common ways to obtain Actions
private void myMethod () {
Actions a =
  • Codota IconWebDriver driver;new Actions(driver)
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

 WebElement svgObject = driver.findElement(By.xpath(YOUR XPATH));
Actions builder = new Actions(driver);
builder.click(svgObject).build().perform();
origin: stackoverflow.com

 Actions actions = new Actions(driver);
WebElement menuHoverLink = driver.findElement(By.linkText("Menu heading"));
actions.moveToElement(menuHoverLink);

WebElement subLink = driver.findElement(By.cssSelector("#headerMenu .subLink"));
actions.moveToElement(subLink);
actions.click();
actions.perform();
origin: selenide/selenide

 protected void click(Driver driver, WebElement element, int offsetX, int offsetY) {
  if (driver.config().clickViaJs()) {
   driver.executeJavaScript("arguments[0].dispatchEvent(new MouseEvent('click', {" +
     "'view': window," +
     "'bubbles': true," +
     "'cancelable': true," +
     "'clientX': arguments[0].getClientRects()[0].left + arguments[1]," +
     "'clientY': arguments[0].getClientRects()[0].top + arguments[2]" +
     "}))",
    element,
    offsetX,
    offsetY);
  }
  else {
   driver.actions()
    .moveToElement(element, offsetX, offsetY)
    .click()
    .build()
    .perform();
  }
 }
}
origin: stackoverflow.com

 Actions actions = new Actions(driver);
actions.moveToElement(website);
actions.click();
actions.sendKeys("Some Name");
actions.build().perform();
origin: TEAMMATES/teammates

public void verifyProfilePhoto(String courseId, String studentName, String urlRegex) {
  String rowId = getStudentRowId(courseId, studentName);
  verifyImageUrl(urlRegex, browser.driver
      .findElement(By.id("studentphoto-c" + rowId))
      .findElement(By.tagName("img"))
      .getAttribute("src"));
  WebElement photo = browser.driver.findElement(By.id("studentphoto-c" + rowId))
                   .findElement(By.cssSelector(".profile-pic-icon-click > img"));
  JavascriptExecutor jsExecutor = (JavascriptExecutor) browser.driver;
  jsExecutor.executeScript("arguments[0].scrollIntoView(true); window.scrollBy(0, -100);", photo);
  Actions action = new Actions(browser.driver);
  action.click(photo).build().perform();
  verifyImageUrl(urlRegex, browser.driver
      .findElement(By.id("studentphoto-c" + rowId))
      .findElement(By.cssSelector(".popover-content > .profile-pic"))
      .getAttribute("src"));
}
origin: TEAMMATES/teammates

/**
 * Scrolls element to first cell in spreadsheet, clicks on it and sends the value as keystrokes.
 */
void scrollElementToFirstCellAndSendKeys(WebElement spreadsheetElement, String value) {
  new Actions(browser.driver).moveToElement(spreadsheetElement)
      .click().sendKeys(value).build().perform();
}
origin: stackoverflow.com

 public void ClearAndSetText(By by, string text)
{
  WebElement element = driver.findElement(by);
  Actions navigator = new Actions(driver);
  navigator.click(element)
    .sendKeys(Keys.END)
    .keyDown(Keys.SHIFT)
    .sendKeys(Keys.HOME)
    .keyUp(Keys.SHIFT)
    .sendKeys(Keys.BACK_SPACE)
    .sendKeys(text)
    .perform();
}
origin: xebia/Xebium

@Override
protected Void handleSeleneseCommand(WebDriver driver, String locator,
    String value) {
  WebElement webElement = driver.findElement(By.xpath(locator));
  new Actions(driver).click(webElement).click().perform();
  return null;
}
origin: stackoverflow.com

 driver.findElement(By.xpath("id=menu")).click(); 
WebElement subMenu=driver.findElement(By.xpath("id=sub_menu_a"));   
Actions myaction = new Actions(driver);
myaction.moveToElement(subMenu);
WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.elementToBeClickable(subMenu));
myaction.click().perform();
origin: stackoverflow.com

 Actions actions = new Actions(driver);
WebElement menuHoverLink = driver.findElement(By.linkText(hoverMenu));
actions.moveToElement(menuHoverLink);

WebElement submenu = new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfNestedElementLocatedBy(menuHoverLink, By.xpath(".//span[.='" + subMenuName + "']")))

actions.moveToElement(submenu);
actions.click().perform();
origin: stackoverflow.com

WebDriver driver=new FirefoxDriver();
   driver.get("http://www.kgisliim.ac.in/");
   Actions  actions=new Actions(driver);
   WebElement menuHoverLink=driver.findElement(By.linkText("Alumni"));
   actions.moveToElement(menuHoverLink);
   //driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
   WebElement subLink=driver.findElement(By.cssSelector(".options>ul>li>a"));
   actions.moveToElement(subLink);
   actions.click();
   actions.perform();
origin: stackoverflow.com

Actions actionobj = new Actions(fd1);        
 actionobj.moveToElement(heatmap);
 actionobj.pause(10000); //wait 10 seconds
 actionobj.click(heatmap);
 actionobj.perform();
origin: stackoverflow.com

 Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.click();
actions.sendKeys("Some Name");
actions.build().perform();
origin: songgeb/BDIndexSpider

/**
 * 选择最近7天数据
 */
public static void clickCurrentSevenDaysData(WebDriver webdriver, Actions builder) {
  WebElement currElement = webdriver.findElement(By.linkText("7天"));
  builder.moveToElement(currElement).click().build().perform();
  Wait.waitForLoad(webdriver);
}
origin: se.redmind/rmtest-cucumber-selenium

@When("^" + THAT + THE_USER + " " + INPUT + " " + QUOTED_CONTENT + "$")
public void that_we_input(String content) {
  content = valueOf(content);
  if (element.getTagName().equals("input") && "file".equals(element.getAttribute("type"))) {
    if (driverWrapper.getDriver() instanceof GridWebDriver) {
      ((RemoteWebElement) element).setFileDetector(new LocalFileDetector());
    }
    element.sendKeys(content);
  } else {
    new Actions(driver).moveToElement(element).click().sendKeys(content).build().perform();
  }
}
origin: com.epam.jdi/jdi-uitest-web

public void clickCenter() {
  invoker.doJAction("Click in Center of Element", () -> {
    Actions builder = new Actions(getDriver());
    builder.click(getWebElement()).perform();
  });
}
origin: com.epam.jdi/jdi-uitest-web

  public void clickByXY(int x, int y) {
    invoker.doJAction(format("Click on Element with coordinates (x,y) = (%s, %s)", x, y),
        () -> new Actions(getDriver())
            .moveToElement(getWebElement(), x, y).click().build().perform());
  }
}
origin: Wikia/selenium-tests

public void clickFormatting(By formatBy) {
 wait.forElementClickable(formattingDropDown);
 Actions actions = new Actions(driver);
 actions.click(formattingDropDown)
   .click(formattingDropDownItems.findElement(formatBy).findElement(menuItemBy))
   .build()
   .perform();
}
origin: viltgroup/minium

  @Override
  protected void doPerform() {
    WebElement source = isSourceDocumentRoot() ? null : getFirstElement();
    if (offset != null) {
      Point offsetPoint = offset.offset(getSize());
      getActions().moveToElement(source, offsetPoint.x(), offsetPoint.y()).click().perform();
    } else {
      getFirstElement().click();
    }
  }
}
origin: Wikia/selenium-tests

public void clickVolumeButton() {
 builder.moveToElement(driver.findElement(PLAYER_SELECTOR))
   .pause(1000)
   .moveToElement(volumeButton, 30, 30)
   .click()
   .perform();
}
org.openqa.selenium.interactionsActionsclick

Javadoc

Clicks at the current mouse location. Useful when combined with #moveToElement(org.openqa.selenium.WebElement,int,int) or #moveByOffset(int,int).

Popular methods of Actions

  • <init>
    A constructor that should only be used when the keyboard or mouse were extended to provide additiona
  • perform
    A convenience method for performing the actions without calling build() first.
  • moveToElement
    Moves the mouse to an offset from the top-left corner of the element. The element is scrolled into v
  • build
    Generates a composite action containing all actions so far, ready to be performed (and resets the in
  • doubleClick
    Performs a double-click at middle of the given element. Equivalent to: Actions.moveToElement(element
  • release
    Releases the depressed left mouse button, in the middle of the given element. This is equivalent to:
  • clickAndHold
    Clicks (without releasing) in the middle of the given element. This is equivalent to:Actions.moveToE
  • sendKeys
    Sends keys to the active element. This differs from calling WebElement#sendKeys(CharSequence...) on
  • contextClick
    Performs a context-click at middle of the given element. First performs a mouseMove to the location
  • dragAndDropBy
    A convenience method that performs click-and-hold at the location of the source element, moves by a
  • dragAndDrop
    A convenience method that performs click-and-hold at the location of the source element, moves to th
  • keyDown
  • dragAndDrop,
  • keyDown,
  • keyUp,
  • moveByOffset,
  • pause,
  • MoveToElement,
  • addKeyAction,
  • apply,
  • asKeys

Popular in Java

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JCheckBox (javax.swing)
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now