[英]Identify popup window Selenium in IE11 32 bit C#
I am having trouble identifying a popup to handle it. 我在确定要处理的弹出窗口时遇到了麻烦。 This is what I tried:
这是我尝试的:
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";
}
}
}
What else can I do to identify this pop-up? 我还能做些什么来识别此弹出窗口?
After testing around, it's confirmed that Window Spy tool is a good way to identify if a pop-up is generated by the browser/driver. 经过测试后,可以确认Window Spy工具是识别浏览器/驱动程序是否生成弹出窗口的好方法。 In
ahk_exe
line, it will say a window is run by which executable file. 在
ahk_exe
行中,它将说一个窗口由哪个可执行文件运行。 In my case, the pop-up is indeed a Java plug-in that is loaded from the website and run on my computer. 就我而言,弹出窗口确实是一个Java插件,可以从网站上加载并在我的计算机上运行。 I finally use AutoIt to handle that window.
我终于使用AutoIt处理该窗口。 If anyone use AutoIt, keep in mind that it is a DIFFERENT language and all actions must be initiated in its format.
如果有人使用AutoIt,请记住这是一种不同的语言,所有操作都必须以其格式启动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.