简体   繁体   English

如何在硒机器人框架中使用JavaScript接受警报

[英]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.

相关问题 如何在硒机器人框架脚本中使用JavaScript单击元素? - How to click an element using javascript in selenium robot framework script? 如何使用 Python、JavaScript 或 Robot Framework 和 Selenium 使用部分标题文本导航到新的浏览器窗口 - How to navigate to new browser window using partial title text using either Python, or JavaScript or Robot Framework and Selenium 如何使用 selenium 机器人框架在 Firefox 中处理打印预览 - How to handle print preview in Firefox using selenium robot framework 如何在 Robot Framework 中使用 javascript 获取元素的值? - How to get the value of an element using javascript in Robot Framework? 如何在 Chrome 中使用 Selenium-Webdriver for JavaScript 接受不安全的证书? - How to accept insecure certificates in Chrome using Selenium-Webdriver for JavaScript? Robot Framework:使用执行 JavaScript 单击元素 - Robot Framework: Click Element using Execute JavaScript 机器人框架:使用执行 javascript 单击按钮 - Robot Framework: Click button using execute javascript 如何在Puppeteer中接受JavaScript警告弹出窗口? - How to accept a JavaScript alert popup in Puppeteer? 如何将Robot Framework变量传递给JavaScript - How to pass Robot Framework variable to JavaScript 如何接受不同窗口中出现的硒警报? - How to accept alert in selenium which is coming up in a different window?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM