我无法确定要处理的弹出窗口。这是我尝试过的:
string dialog4;
string dialog5;
try
{
IAlert alert = driver.SwitchTo().Alert();
dialog4 = alert.Text;
alert.Accept();
dialog5 = "nothing alert";
}
catch (NoAlertPresentException f)
{
try
{
dialog4 = driver.SwitchTo().Frame(0).Title;// "dialog4";//
dialog5 = driver.SwitchTo().Frame(1).Title;// "dialog5";//
}
catch (NoSuchFrameException e)
{
try
{
dialog4 = driver.SwitchTo().Window("iHTKK").Title;
dialog5 = "nothing window";
}
catch
{
dialog4 = "nothing 4";
dialog5 = "nothing 5";
}
}
}
答案 0 :(得分:0)
经过测试,可以确认Window Spy工具是识别浏览器/驱动程序是否生成弹出窗口的好方法。在ahk_exe
行中,它将说一个窗口由哪个可执行文件运行。就我而言,弹出窗口确实是一个Java插件,可以从网站上加载并在我的计算机上运行。我终于使用AutoIt处理该窗口。如果有人使用AutoIt,请记住这是一种不同的语言,所有操作都必须以其格式启动。