在此page上,当数字错误数据打开警报错误时,我需要检查此警报是否打开,如果打开需要关闭,我将编写此代码bat不工作:
示例警报图像:http://snag.gy/8WM0q.jpg
我的实际代码:
driver = webdriver.Firefox()
driver.get("https://secure.ingdirect.it/login.aspx")
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_txtCodiceCliente").clear()
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_txtCodiceCliente").send_keys('1234567')
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_txtgg").clear()
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_txtgg").send_keys("01")
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_txtmm").clear()
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_txtmm").send_keys("01")
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_txtaaaa").clear()
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_txtaaaa").send_keys("1999")
driver.find_element_by_id("ctl00_cphContenuto_LoginContainerUC1_LoginStepCifUC1_lnbvanti").click()
if self.is_element_present(By.LINK_TEXT, "chiudi"):
driver.find_element_by_link_text("chiudi").click()
return
如何检查此警报是否存在并关闭它
您只需使用以下代码检查弹出窗口是否出现(如果弹出窗口已打开,请关闭它;如果没有弹出窗口,则不执行任何操作):
相关问题 更多 >
编程相关推荐