【发布时间】:2022-11-21 06:13:54
【问题描述】:
我需要在 python 中使用 selenium 来定位按钮。检查元素如下所示:
<button tabindex="50" title="Drukuj potwierdzenie" style="margin-top:-3px;" type="button" id="superPrintButton" class="btn btn-emptyAk printButtonLoader">Drukuj potwierdzenie</button>
我尝试了以下 - 没有运气:
x = driver.find_element(By.XPATH, '//*[contains(@title="Drukuj potwierdzenie")]')
x = driver.find_element("xpath", '//[contains(@title, "Drukuj potwierdzenie")')
x = driver.find_element(By.CLASS_NAME, "printButtonLoader")
x = driver.find_element(By.CLASS_NAME, "btn btn-emptyAk printButtonLoader")
x = driver.find_element(By.ID, "superPrintButton")
x = driver.find_element(By.CSS_SELECTOR, "[title^='Drukuj potwierdzenie']")
知道什么会起作用吗?
【问题讨论】:
标签: selenium driver element inspect