【问题标题】:How to click the close button within a modal window through Python Selenium如何通过 Python Selenium 在模态窗口中单击关闭按钮
【发布时间】:2022-07-25 01:18:15
【问题描述】:

无法点击关闭按钮 class="close whitebutton"

<button type="button" class="close whitebutton" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>

尝试如下class_name,还是不行,不知道为什么?:

driver.find_element(By.CLASS_NAME, "whitebutton").click()

【问题讨论】:

  • 如果你运行 btn = driver.find_element(By.CLASS_NAME, "whitebutton") 然后运行 ​​type(btn) 你会得到什么?
  • 请显示您要选择的标记。
  • 添加url,我们会尝试点击它。

标签: python selenium selenium-webdriver web-crawler


【解决方案1】:

我只是通过检查复制 xpath-->chrome 上的元素

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-29
    • 2014-07-21
    • 2021-12-31
    • 1970-01-01
    • 1970-01-01
    • 2021-04-18
    • 1970-01-01
    • 2018-03-01
    相关资源
    最近更新 更多