我想使用 selenium 單擊選單按鈕,但無法使用 WebDriverWait 或任何其他方式。我怎么可以點擊它用硒從https://www.dappradar.com/binance-smart-chain/defi/drip這里
<div class="apexcharts-menu-icon" title="Menu"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"></path><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path></svg></div>
uj5u.com熱心網友回復:
SVG包裹在div標簽內,因此您可以定位SVG或div.
我可以這樣做div:
driver.maximize_window()
wait = WebDriverWait(driver, 30)
driver.get("https://dappradar.com/binance-smart-chain/defi/drip")
try:
wait.until(EC.element_to_be_clickable((By.XPATH, "//button[@title='Close']"))).click()
print('Clicked on closed icon')
except:
pass
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@title='Menu']"))).click()
進口:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/420596.html
標籤:
上一篇:持有使用JPA構建的表
