Double Click

Use Actions class to double-click the target box.

Double-click this target
How to test
// Java
WebElement target = driver.findElement(By.id("double_click_target"));
new Actions(driver).doubleClick(target).perform();

# Python
target = driver.find_element(By.ID, "double_click_target")
ActionChains(driver).double_click(target).perform()

// Java - Full Test
driver.findElement(By.id("double_click_reset")).click();
WebElement target = driver.findElement(By.id("double_click_target"));
Actions actions = new Actions(driver);
actions.doubleClick(target).perform();
WebElement result = driver.findElement(By.id("double_click_success"));
assert result.isDisplayed();
assert result.getText().contains("Double click completed");

# Python - Full Test
driver.find_element(By.ID, "double_click_reset").click()
target = driver.find_element(By.ID, "double_click_target")
ActionChains(driver).double_click(target).perform()
result = driver.find_element(By.ID, "double_click_success")
assert result.is_displayed()
assert "Double click completed" in result.text

// Java - Alternative Solution
new Actions(driver)
    .doubleClick(driver.findElement(By.id("double_click_target")))
    .perform();

# Python - Alternative Solution
ActionChains(driver).double_click(
    driver.find_element(By.ID, "double_click_target")
).perform()


Tester Task
  1. Locate the target using id double_click_target.
  2. Create a Selenium Actions object.
  3. Double-click the target using Actions.
  4. Verify double_click_success is displayed.
  5. Verify the result contains Double click completed.