WebDriver中使用的AlertOverride类是什么? [英] What is the AlertOverride class used for in WebDriver?

查看:111
本文介绍了WebDriver中使用的AlertOverride类是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Selenium 2.0中,我见过一个与WebDriverCommandProcessor一起使用的类AlertOveride。不幸的是,我似乎找不到关于该类的任何文档,没有人知道该类的用途吗?

In Selenium 2.0 there is a class I've seen used with WebDriverCommandProcessor called AlertOveride. Unfortunately I cannot seem to find any documentation around this class, does anyone have any knowledge of what the class is meant to be used for?

推荐答案

查看文件中的JavaScript,看来该类负责重写警报和确认框,这些框通常在被测应用程序中调用时会看到。硒的工作方式无法与那些模式框进行交互,因此需要覆盖其默认值。我没有办法重写该功能(尽管它可以通过DesiredCapability来实现)。

Looking at the JavaScript in the file it seems that this class is responsible for overriding the alert and confirm boxes that we would typically see when invoked in the application under test. The way selenium works it was unable to interact with those modal boxes, hence the need to override their defaults. I don't see a way to override that functionality (although it might be doable with a DesiredCapability).

我猜想这是WebDriver实例的第一件事加载页面时执行的操作是调用AlertOverride类中的方法,以便我们可以尽快获取警报/确认的句柄。这对于为什么我们无法处理onload函数上创建的确认框也很有意义。

I'm guessing that one of the first things the WebDriver instance does upon loading a page is invoking the methods in the AlertOverride class, so that we can get a handle on alerts/confirmations as soon as possible. This would also make sense as to why we can't get a handle on confirmation boxes that are created on the onload functions.

这篇关于WebDriver中使用的AlertOverride类是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆