هل يمكنني قراءة مربع التنبيه جافا سكريبت مع WatiN؟

StackOverflow https://stackoverflow.com/questions/458177

  •  19-08-2019
  •  | 
  •  

سؤال

وأريد استخدام WatiN للتحقق من رسالة الخطأ في مربع التنبيه جافا سكريبت. هل هذا ممكن؟ شكرا.

هل كانت مفيدة؟

المحلول

إن Trev مدونة و <أ href ل = "http://tmichealson.blogspot.com/2007/03/use-once-dialog.html" يختلط = "نوفولو noreferrer"> هنا كذلك.

using(IE ie = new IE("http://hostname/pagename.htm"))
{
    AlertDialogHandler alertDialogHandler = new AlertDialogHandler();
    using (new UseDialogOnce(ie.DialogWatcher, alertDialogHandler ))
    {
        /*************************************
        * -- alert -- *
        * *
        * must use the "NoWait" to allow *
        * the code to goto the next line *
        * *
        *************************************/

        alertDialogHandler.WaitUntilExists();
        alertDialogHandler.OKButton.Click();
        ie.WaitForComplete();
    }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top