gpt4 book ai didi

selenium - 阅读警报消息并单击“确定”

转载 作者:行者123 更新时间:2023-12-02 19:14:02 29 4
gpt4 key购买 nike

我想阅读警报中的消息。

示例:如果警报显示“错误的电子邮件地址”。怎么读呢?意味着我想将该消息存储在字符串中。

如何在“警报”中单击“确定”...??

如何使用 Selenium 来做到这一点?

最佳答案

我假设您正在使用 Selenium WebDriver。

// Get a handle to the open alert, prompt or confirmation
Alert alert = driver.switchTo().alert();
// Get the text of the alert or prompt
alert.getText();
// And acknowledge the alert (equivalent to clicking "OK")
alert.accept();

答案已找到here .

如果您使用 Selenium RC,请查看 this网页。

关于selenium - 阅读警报消息并单击“确定”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10633889/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com