[英]How to accept alert using javascript in selenium robot framework
I need your expertise to get some solution to my problem. 我需要您的专业知识才能解决我的问题。 there is an automated alert popup is generating while I am deleting some records.
我删除一些记录时会生成一个自动警报弹出窗口。 I have to use javascript in my selenium robot framework script to click OK on alert popup.
我必须在硒机器人框架脚本中使用javascript,以在警报弹出窗口上单击“确定”。 I tried using following javascript codes.
我尝试使用以下JavaScript代码。 but didn't work.
但是没有用 I know some of these are not correct, but tried anyway.
我知道其中一些是不正确的,但还是尝试了。 Can you please help me resolve my issue.
您能帮我解决我的问题吗?
Execute Javascript window.alert('alert text').apply()
Execute Javascript window.alert.apply()
Execute Javascript window.alert('alert text').click()
Thank you for your time and help Yougander K 谢谢您的时间,并为Yougander K提供帮助
if you are looking for the java snippet, you can use this. 如果您正在寻找Java代码段,则可以使用它。
Alert alert = new WebDriverWait(SELENIUM_WEBDRIVER, 30, 100).until(ExpectedConditions.alertIsPresent());
alert.accept(); //if you want to click ok
alert.dismiss(); //if you want to close alert message
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.