Issue 5158: Modal dialog present (UnexpectedAlertOpen) issue in IE (Similar issue like 3360)

https://code.google.com/p/selenium/issues/detail?id=5158

Reported by [email protected], Feb 13, 2013

Hi,
This is pavan,i would like to say thanks for providing great guidance for the people who are working on selenium like me.
Issue:
 i am also encountering the same problem but i could not get the proper solution to resolve this issue

Actually over the period of 2 months we are developing automation application using selenium webdriver and it is running fine and we ran some cycles of regression suites,but now suddenly we are getting the following error Modal dialog present (UnexpectedAlertOpen)but i have verified,there is no model dialog box opened and also there is no IE dev tool opened but still i am getting this issue.
please find the attachment for reference

Configuration details:
IE driver 2.25.2.0
Windows7(32bit)
IE8

we are using C# with selenium

Please help me asap.

Feb 13, 2013

Project Member #1 barancev

Selenium automatically closes unhandled modal diaplogs (and throws an exception). You can disable closing such diaplog you can set capability unexpectedAlertBehaviour to "ignore" (it is "dismiss" by default). In this case an exception will be thrown, but the dialog will not be closed and you‘ll be able to see it.

P.S. By the way, the issue has no attachment you mentioned)
P.P.S. Why do yo use 2.25 ? The latest version is 2.29 at the moment

Status: NeedsClarification

Feb 13, 2013

#2 [email protected]

Hi Can you just make me understand that how to set capability unexpectedAlertBehaviour to "ignore"

and one more importnat ponit is that this error is occuring only on the machine which has mcafee site adviser in rest of all machines scripts are running as expected

i did arrach the doc but no idea why you could not get it.

again i am attaching the same here, please find the same
Modaldialog.doc 
199 KB   Download

Feb 13, 2013

#3 [email protected]

namespace Permedion.Automation.Core
{
    #region Import Namespaces
    using System;
    using System.Configuration;
    using System.IO;
    using System.Xml;
    using OpenQA.Selenium;
    using OpenQA.Selenium.Chrome;
    using OpenQA.Selenium.Firefox;
    using OpenQA.Selenium.IE;
    using OpenQA.Selenium.Remote;
    using OpenQA.Selenium.UnhandledAlertException;
    using OpenQA.Selenium.Safari;
    using System.Windows.Automation;
    using System.Threading;
    #endregion

    /// <summary>
    /// Public class to implement the functionalities related to AutomationBase.
    /// </summary>
    public class AutomationBase
    {
        #region Properties
        /// <summary>
        /// Gets or sets the value of the CurrentWebDriver of type OpenQA.Selenium.IWebDriver.
        /// </summary>
        public static IWebDriver CurrentWebDriver
        {
            get;
            set;
        }
        private Thread autoThread;

        //Declaring global variables
        public static string timerValue;
        public static int iterationCount =1;
        public static string browserType;
        #endregion

        #region Methods
        /// <summary>
        /// Public method which includes logic related to StartBrowser.
        /// </summary>
        /// <returns>Returns object of type OpenQA.Selenium.IWebDriver.</returns>
        public static IWebDriver StartBrowser()
        {
            if (iterationCount <= 1)
            {
              timerValue = (DateTime.Now).ToString().Replace(":", ".");
              iterationCount = iterationCount + 1;
            }

            browserType = ConfigurationManager.AppSettings.Get("Browser");
            switch (browserType.ToUpper())
            {
                case "IE":
                     InternetExplorerOptions options = new InternetExplorerOptions();
                     options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                     options.IgnoreZoomLevel = true;
                     DesiredCapabilities cap = DesiredCapabilities.InternetExplorer();
                     CurrentWebDriver = new InternetExplorerDriver(options);
                     break;
                case "SAFARI":
                    CurrentWebDriver = new SafariDriver();
                    break;
                case "CHROME":
                    CurrentWebDriver = new ChromeDriver();
                    break;
                case "FF":
                default:
                    FirefoxProfile profile = new FirefoxProfile();
                    profile.AcceptUntrustedCertificates = true;
                    CurrentWebDriver = new FirefoxDriver(profile);
                    break;
            }

            return CurrentWebDriver;
        }

Feb 13, 2013

#4 [email protected]

Please find the above piece of code ant make me understand where i went worng.

Thanks,
Pavan

Feb 14, 2013

#5 [email protected]

As you suggested i had configured the selenium with latest drivers i.e 2.9 but still i am facing the same issue with diffrent alert message box.

i am not sure how to use capabilities with options, please help me in this since i am not able to move forward.

the only one diffrence i can see after installing the latest drivers is only change in alert messgae apart from that nothing is workedout.

   InternetExplorerOptions options = new InternetExplorerOptions();
                    options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                    options.IgnoreZoomLevel = true;
                    DesiredCapabilities ieCapabilities = options.ToCapabilities() as DesiredCapabilities;
                    ieCapabilities.SetCapability("Ignore",InternetExplorerUnexpectedAlertBehavior.Ignore);
                    CurrentWebDriver = new InternetExplorerDriver(options);

Feb 14, 2013

Project Member #6 [email protected]

@mailtopavan1987 With the latest .NET bindings, you should not have to use DesiredCapabilities directly in most cases. Specifically, you should be able to do the following:

InternetExplorerOptions options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
options.IgnoreZoomLevel = true;
options.UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Ignore;
CurrentWebDriver = new InternetExplorerDriver(options);

Incidentally, I would encourage you to not use the IntroduceInstabilityByIgnoringProtectedModeSettings option if at all possible[1].

[1] http://jimevansmusic.blogspot.com/2012/08/youre-doing-it-wrong-protected-mode-and.html

Feb 17, 2013

#7 [email protected]

Hi,
I tried with all the solutions given by you but still i am getting the same error messgae.

actually there is no opened dialog box to say options.UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Ignore; but i am wondering why still it is giving such error saying that modal dialog box present (UnhandledAlertException unhandled by user code).

this is happening since we have installed mcafee-siteadviser patch before that no such error occured.

is it because of mcafee-siteadiver? if so is there any solution to overcome this?

Feb 17, 2013

Project Member #8 barancev

See also issue 4839

Labels: Browser-IE

Feb 21, 2013

Project Member #9 [email protected]

Since this behavior is only observed where McAfee SiteAdvisor is installed, I‘m calling this a duplicate of #4839.

Status: Duplicate 
Labels: -Status-Untriaged 
Mergedinto: 4839

时间: 2024-10-17 06:30:57

Issue 5158: Modal dialog present (UnexpectedAlertOpen) issue in IE (Similar issue like 3360)的相关文章

在Asp.net MVC 使用bootstrap 的modal dialog 实现Popup

web应用经常需要弹出modal dialog,此例说明如何使用bootstrap提供的dialog,可以满足大部分场景. 1. 安装nuget 2. 完成以下代码: Home Controller : public ActionResult Index() { return View(); } [HttpPost] public ActionResult Index(HomeVm vm) { TempData["Message"] = string.Format("Subm

Create Custom Modal Dialog Windows For User Input In Oracle Forms

An example is given below to how to create a modal dialog window in Oracle Forms for asking user input and return the value to any text item. The following is the screen shot of this demo and this form could be downloaded from the following link: Cus

jQuery BlockUI Plugin Demo 5(Simple Modal Dialog Example)

Simple Modal Dialog Example This page demonstrates how to display a simple modal dialog. The button below will invoke blockUI with a custom message. Depending upon the user response (yes or no) an ajax call will be made while keeping the UI blocked.

wxPython Modal Dialog模式对话框,Python对话框中打开对话框

今天用wxPython写一个输入关键词自动生成文章工具,设置部分需要用模式对话框来打开设置界面.下面介绍wxPython Modal Dialog模式对话框: 1. Modal Dialog(模式对话框) A modal dialog blocks other widgets from receiving user events until it is closed; in other words, it places the user in dialog mode for the durati

iframe中的jquery ui modal dialog 覆盖父窗口参考

function openDialog(){ var $doc; if(window.location!=window.parent.location){ // <SPAN style="COLOR: #ff0000">页面在iframe中</SPAN> $doc=window.parent.jQuery.noConflict(); }else{ // <SPAN style="COLOR: #ff0000">页面单独打开<

issue和motd和redhat-release相关的作用

/etc/issue和/etc/motd和/etc/redhat-release 1./etc/issue  用   法:当我们在终端接口登录的时候,会有几行提示字符串,那么这个字符串就是设置在/etc/issue. 出现在登陆前. [root@linux ~]#cat /etc/issue  CentOS release 5.6 (Final)  Kernel \r on an \m issue内各代码说明:  \d  本地端时间的日期  \l  显示第几个终端接口  \m  显示硬件的等级 

wx.Dialog

wx.Dialog A dialog box is a window with a title bar and sometimes a system menu, which can be moved around the screen. It can contain controls and other windows and is often used to allow the user to make some choice or to answer a question. Dialogs

IOS的模态窗口(modal)

在iOS开发中,除了使用push方法切换控制器以外,modal也可以实现界面切换,使用modal方便快捷,任何控制器都可以使用modal展示出来,开发中在设置注册,购物车,点赞等小功能的时候可以使用. 首先我们简单了解下ViewController之间的跳转 1.如果在 Storyboard中当前的 ViewController和要跳转的ViewController之间的segue存在,则可以执行performSegueWithIdentifier:sender:这个方法实现跳转.2.如果目标V

mfc dialog用法

CDialogThe CDialog class is the base class used for displaying dialog boxes on the screen. Dialog boxes are of two types: modal and modeless. A modal dialog box must be closed by the user before the application continues. A modeless dialog box allows