[英]How to click dynamic button using Selenium and Python
我不知道如何單擊此動態按鈕,該按鈕沒有可用於單擊的HTML元素。
我試圖通過使用“ find_element_by_tag_name”單擊按鈕,但是它不起作用。 我在此處發布按鈕的代碼:
<a href="https://www.facebook.com/n/?confirmemail.php&" style="color:#3b5998;text-decoration: none" target="_blank" tabindex="-1"rel="external"></a>
如果您知道href
的開頭,則可以在XPath starts-with
:
dynamic_button_xpath = "//a[starts-with(@href, 'https://www.facebook.com/n/?')]"
driver.find_element_by_xpath(dynamic_button_xpath).click()
希望這對您有所幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.