是否有任何函数/类来处理浏览器中的警报或任何其他类型的弹出窗口。 我正在处理一个警报弹出窗口,我知道我可以通过使用driver.switchto().alert();来处理它driver.switchto().alert(); 并执行进一步的操作。 由于Serenity BDD非常适合处理元素,因此可以使用任何特定功能来处理警报(仅限于使用宁静的BDD功能)。
Is there any function/class to handle alert or any other types of popups in a browser. I am dealing with an alert popup I know I can handle it by using driver.switchto().alert(); and perform further actions. Since Serenity BDD is quite tailored to handle elements is there any specific function to handle alerts (only by using serenity BDD functions).
最满意答案
这就是Serenity PageObject的getAlert()方法的样子:
public Alert getAlert() { return driver.switchTo().alert(); }这是driver对象引用的内容:
private WebDriver driver;正如您可能已经猜到的那样, WebDriver类型/对象来自Selenium。 因此,回答你的问题,是的,Serenity中有一种方法可以获取警报弹出窗口,但它是对Selenium的直接引用。
This is what Serenity PageObject's getAlert() method looks like:
public Alert getAlert() { return driver.switchTo().alert(); }And this is what driver object references:
private WebDriver driver;As you might have guessed it already, the WebDriver type/object comes from Selenium. Hence to answer your question, yes there is a method in Serenity to grab alert popups, but it's a direct reference to Selenium.
更多推荐
发布评论