Selenium,单击没有 id python 的提交按钮
Selenium, click submit button with no id python
我正在努力寻找一种方法来点击下面的提交按钮 class。它不包含 ID、名称或任何非动态生成的易于识别的方法。任何帮助表示赞赏。
到目前为止我已经尝试过:
driver.find_element_by_xpath("//div[@class='button-status-container'][@type='submit']")
driver.find_element_by_xpath("//div[@class='button-status-container']//button-status-container[@type='submit']")
driver.find_element_by_css_selector('.button-status-container[type="button"]')
以上所有错误都用 NoSuchElementException
解决了。
the htlm of submit button
我认为正确的 xpath/css 选择器应该是:
driver.find_element_by_xpath("//div[@class='button-status-container']/button[@type='submit']")
driver.find_element_by_css_selector('.button-status-container > [type="button"]')
我正在努力寻找一种方法来点击下面的提交按钮 class。它不包含 ID、名称或任何非动态生成的易于识别的方法。任何帮助表示赞赏。
到目前为止我已经尝试过:
driver.find_element_by_xpath("//div[@class='button-status-container'][@type='submit']")
driver.find_element_by_xpath("//div[@class='button-status-container']//button-status-container[@type='submit']")
driver.find_element_by_css_selector('.button-status-container[type="button"]')
以上所有错误都用 NoSuchElementException
解决了。
the htlm of submit button
我认为正确的 xpath/css 选择器应该是:
driver.find_element_by_xpath("//div[@class='button-status-container']/button[@type='submit']")
driver.find_element_by_css_selector('.button-status-container > [type="button"]')