selenium+python3 怎样判断有没有提示框出现? 5
展开全部
你好,下面是一个判断有无提示框出现的源码:
class alert_is_present(object):
""" Expect an alert to be present."""
"""判断当前页面的alert弹窗"""
def __init__(self):
pass
def __call__(self, driver):
try:
alert = driver.switch_to.alert
alert.text
return alert
except NoAlertPresentException:
return False
class alert_is_present(object):
""" Expect an alert to be present."""
"""判断当前页面的alert弹窗"""
def __init__(self):
pass
def __call__(self, driver):
try:
alert = driver.switch_to.alert
alert.text
return alert
except NoAlertPresentException:
return False
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询