我正在使用以下元素:
<p class="wrap button draggable" id="anonymous_element_1"><b class="icon" id="handler2"></b>Reports</p>
到目前為止我有這個代碼:
click_button=driver.find_element_by_xpath('//*[@id="anonymous_element_1"]').click()
如何雙擊元素?
uj5u.com熱心網友回復:
要雙擊元素,您可以使用ActionChains實作中的double_click()方法為element_to_be_clickable()引入WebDriverWait ,如下所示:
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()
注意:您必須添加以下匯入:
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
uj5u.com熱心網友回復:
你試過了嗎:
xyz.click(); 執行緒.sleep(10); xyz.click();
?
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/460954.html
標籤:python-3.x 硒 硒网络驱动程序 网络驱动程序等待 双击
