[英]Event should trigger when Toastr notification appears
i want to trigger an event using protractor for close the Toastr notification messages. 我想使用量角器触发事件以关闭Toastr通知消息。 whenever the notification appears this event should triggered.. is this possible?? 每当通知出现时,都应触发此事件。这可能吗?
I have 10 forms ,i am validating these forms using protractor. 我有10个表格,我正在使用量角器验证这些表格。 In each form i have editable text fields. 在每种形式中,我都有可编辑的文本字段。 If you add/edit/delete any fields you will get toastr notification message. 如果您添加/编辑/删除任何字段,您将收到烤面包机通知消息。 I want to close these messge whenever it appears in my appliaction. 每当应用程序中出现这些消息时,我都想将其关闭。 is this possible?? 这可能吗?? Thanks in advance.. 提前致谢..
You can execute JS
code while running your test for closing toastr
notification, you could try this one (I tested it in their demo project - run this code toastr.remove()
in a console when toastr notification was shown): 您可以在运行测试以关闭toastr
通知的同时执行JS
代码,也可以尝试执行此代码(我在他们的演示项目中对其进行了测试-当显示toastr通知时,在控制台中运行此代码toastr.remove()
):
await browser.executeScript(toastr.remove())
note that browser.executeScript()
return Promise
so you need to resolve it. 请注意, browser.executeScript()
返回Promise
因此您需要解决它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.