gpt4 book ai didi

firefox - 此页面要求您确认是否要离开

转载 作者:行者123 更新时间:2023-12-02 18:06:10 24 4
gpt4 key购买 nike

我正在我的站点安装上运行行为测试。运行测试时我收到以下错误。我转而使用 Firefox,因为我在使用新的 chromedriver 2.10 时遇到了问题。我可以解决这个问题吗?

错误消息:

Modal dialog present: This page is asking you to confirm that you want to leave - data you have entered may not be saved.

Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'jesus-ProLiant-MicroServer', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-32-generic', java.version: '1.6.0_32'

Session ID: 2d072ef8-60e8-494b-b389-96e954041fb0
Driver info: org.openqa.selenium.firefox.FirefoxDriver

Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=31.0, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]

最佳答案

你(官方)对此不走运。 Behat/Mink 不支持对话处理,并且在找到对话时会抛出异常,因为它对此无能为力,并且会阻止后续步骤。有一个long standing issue on github这解释了原因,我同意亚历山大的最后评论:

Nowadays browser dialogs are considered bad UX and are replaced by nice looking modal windows (at least on websites I was doing), which already can be handled.

非官方地,如果您直接调用 Selenium 驱动程序,this gist 是可能的。是如何做到这一点的最好例子。如果您搜索“selenium modal window”而不引用 Behat,您可以找到更多相关信息。

$this->getSession()->getDriver()->getWebDriverSession()->accept_alert(); // Ok
$this->getSession()->getDriver()->getWebDriverSession()->dismiss_alert(); // Dismiss

关于firefox - 此页面要求您确认是否要离开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25623600/

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