/// <summary>
        /// Returns a <see cref="MessageBox"/> with the specified parameters.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="title">The title of message box to search for.</param>
        /// <param name="icon">The MessageBox icon to look for.</param>
        /// <param name="message">The message to search for.</param>
        /// <param name="assertIsEnabled">If set to <c>true</c>, asserts the MessageBox is enabled (default is <c>true</c>).</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the MessageBox (default is 5).</param>
        /// <returns>The first matching MessageBox.</returns>
        public static MessageBox GetMessageBox(this WisejWebDriver driver, string title,
                                               MessageBoxIcon icon, string message, bool assertIsEnabled = true, int timeoutInSeconds = 5)
        {
            MessageBox messageBox = driver.GetMessageBoxCore(title, icon, message, timeoutInSeconds);

            if (assertIsEnabled)
            {
                Assert.IsTrue(messageBox.Enabled, GetMessage("MessageBox {0} isn't enabled.", title, message));
            }

            return(messageBox);
        }
        /// <summary>
        /// Returns a <see cref="MessageBox"/> with the specified icon.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="icon">The MessageBoxIcon to look for.</param>
        /// <param name="assertIsEnabled">If set to <c>true</c>, asserts the MessageBox is enabled (default is <c>true</c>).</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the MessageBox (default is 5).</param>
        /// <returns>The first matching MessageBox.</returns>
        public static MessageBox GetMessageBoxWithIcon(this WisejWebDriver driver, MessageBoxIcon icon,
                                                       bool assertIsEnabled = true, int timeoutInSeconds = 5)
        {
            MessageBox messageBox = driver.GetMessageBoxCore(null, icon, null, timeoutInSeconds);

            if (assertIsEnabled)
            {
                Assert.IsTrue(messageBox.Enabled,
                              GetMessage("MessageBox {0} isn't enabled.", string.Empty, string.Empty));
            }

            return(messageBox);
        }
示例#3
0
        /// <summary>
        /// Returns a <see cref="MessageBox"/> with the specified message.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="message">The MessageBox message to search for.</param>
        /// <param name="assertIsEnabled">If set to <c>true</c>, asserts the MessageBox is enabled (default is <c>true</c>).</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the MessageBox (default is 5).</param>
        /// <returns>The first matching MessageBox.</returns>
        public static MessageBox GetMessageBoxWithMessage(this WisejWebDriver driver, string message,
                                                          bool assertIsEnabled = true, long timeoutInSeconds = 5)
        {
            MessageBox messageBox =
                driver.GetMessageBoxCore(string.Empty, true, MessageBoxIcon.None, message, timeoutInSeconds);

            if (assertIsEnabled)
            {
                Assert.IsTrue(messageBox.Enabled, GetMessage("MessageBox {0} isn't enabled.", string.Empty, message));
            }

            return(messageBox);
        }