Issue
I am working with the following element:
<p class="wrap button draggable" id="anonymous_element_1"><b class="icon" id="handler2"></b>Reports</p>
I have this code so far:
click_button=driver.find_element_by_xpath('//*[@id="anonymous_element_1"]').click()
How can I double click on the element?
Solution
To double_click on the element you can use double_click()
method from ActionChains implementation inducing WebDriverWait for the element_to_be_clickable() as follows:
ActionChains(driver).double_click(WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//p[@class='wrap button draggable' and @id='anonymous_element_1'][contains(., 'Reports')]")))).perform()
Note : You have to add the following imports :
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
Answered By – undetected Selenium
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0