如何使用Selenium WebDriver-Python单击弹出窗口中的复选框按钮

时间:2017-03-14 20:43:00

标签: python selenium selenium-webdriver

screen shoot of the pop-up window

我需要关注弹出窗口并选中复选框。(附上截图)

我尝试定义浏览器以接受将显示的每个弹出窗口。

def update_firefox_profile():
      profile = webdriver.FirefoxProfile()
      profile.accept_untrusted_certs = True
      profile.assume_untrusted_cert_issuer = False
      profile.update_preferences()
      return profile

你有另一个想法吗? 谢谢!

1 个答案:

答案 0 :(得分:0)

请检查这是弹出的网页弹出窗口还是弹出窗口。如果它是一个Web弹出窗口,则尝试检查弹出窗口中的元素以选择所需的复选框。弹出窗口,可以使用AutoIT脚本。另一种方法是使用import java.awt.Robot。使用Robot类,您可以发送键盘事件以选择所需的复选框,然后单击提交按钮。但在这种情况下,您应该假设复选框的顺序是相同的。