هل يمكنني قراءة مربع التنبيه جافا سكريبت مع WatiN؟
-
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();
}
}
لا تنتمي إلى StackOverflow