public static IAlert AlertOrNull(this ITargetLocator locator)
 {
     try
     {
         return(locator.Alert());
     }
     catch (NoAlertPresentException)
     {
         return(null);
     }
 }
示例#2
0
 public static IAlert?TryGetAlert(this ITargetLocator locator)
 {
     try
     {
         return(locator.Alert());
     }
     catch
     {
         return(null);
     }
 }
 public static IAlert WaitAlert(this ITargetLocator locator, int seconds = 10)
 {
     while (true)
     {
         try { return(locator.Alert()); }
         catch (NoAlertPresentException) when(--seconds >= 0)
         {
             Thread.Sleep(1000);
         }
     }
 }
示例#4
0
        public void WindowProcess_Demo3()
        {
            IWebDriver driver = new FirefoxDriver();
            //省略部分代码... ...
            var            oldWinHandle = driver.CurrentWindowHandle;
            ITargetLocator locator      = driver.SwitchTo();
            IAlert         winAlert     = locator.Alert();

            winAlert.Accept();                            //确定:Alert , Confirm, Prompt
            winAlert.Dismiss();                           //取消:Confirm, Prompt
            var text = winAlert.Text;                     //获取提示内容:Alert , Confirm, Prompt

            winAlert.SendKeys("input text.");             //输入提示文本:Prompt

            //后续操作... ...
            driver.Quit();
        }
示例#5
0
 public AlertInstance Alert()
 {
     return(new AlertInstance(this.Engine.Object.InstancePrototype, m_targetLocator.Alert()));
 }
示例#6
0
 public IAlert Alert()
 {
     lock (m_lock) { return(locator.Alert()); }
 }
示例#7
0
 public IAlert Alert()
 {
     return(_targetLocator.Alert());
 }
示例#8
0
 public IAlert Alert()
 {
     return(targetLocator_.Alert());
 }
 public IAlert Alert()
 {
     return(_targetLocator.Alert().ToWrapper());
 }