Exemple #1
0
 public void Missing_dialog_throws_coypu_exception()
 {
     using (Driver)
     {
         Assert.Throws <MissingDialogException>(() => Driver.AcceptModalDialog(Root));
         Assert.Throws <MissingDialogException>(() => Driver.CancelModalDialog(Root));
     }
 }
 public void Returns_true()
 {
     using (Driver)
     {
         Driver.Click(Driver.FindLink("Trigger a confirm", Root));
         Driver.AcceptModalDialog(Root);
         Driver.FindLink("Trigger a confirm - accepted", Root).should_not_be_null();
     }
 }
 public void Returns_true()
 {
     using (Driver)
     {
         Driver.Click(Link("Trigger a confirm"));
         Driver.AcceptModalDialog(Root);
         Link("Trigger a confirm - accepted", Root).ShouldNotBeNull();
     }
 }
 public void Accepts_alerts()
 {
     using (Driver)
     {
         Driver.Click(Driver.FindLink("Trigger an alert", Root));
         Driver.HasDialog("You have triggered an alert and this is the text.", Root).should_be_true();
         Driver.AcceptModalDialog(Root);
         Driver.HasDialog("You have triggered an alert and this is the text.", Root).should_be_false();
     }
 }
 public void Clears_dialog()
 {
     using (Driver)
     {
         Driver.Click(Driver.FindLink("Trigger a confirm", Root));
         Driver.HasDialog("You have triggered a confirm and this is the text.", Root).should_be_true();
         Driver.AcceptModalDialog(Root);
         Driver.HasDialog("You have triggered a confirm and this is the text.", Root).should_be_false();
     }
 }
 public void Clears_dialog()
 {
     using (Driver)
     {
         Driver.Click(Link("Trigger a confirm"));
         Driver.HasDialog("You have triggered a confirm and this is the text.", Root).ShouldBeTrue();
         Driver.AcceptModalDialog(Root);
         Driver.HasDialog("You have triggered a confirm and this is the text.", Root).ShouldBeFalse();
     }
 }
 public void Accepts_alerts()
 {
     using (Driver)
     {
         Driver.Click(Link("Trigger an alert"));
         Driver.HasDialog("You have triggered an alert and this is the text.", Root).ShouldBeTrue();
         Driver.AcceptModalDialog(Root);
         Driver.HasDialog("You have triggered an alert and this is the text.", Root).ShouldBeFalse();
     }
 }
Exemple #8
0
        public void Finds_scope_first_for_alerts()
        {
            using (Driver)
            {
                Driver.Click(Link("Open pop up window"));
                var popUp = new BrowserWindow(DefaultSessionConfiguration, new WindowFinder(Driver, "Pop Up Window", Root, DefaultOptions), Driver, null, null, null, DisambiguationStrategy);
                Assert.That(Driver.Title(popUp), Is.EqualTo("Pop Up Window"));

                Driver.ExecuteScript("window.setTimeout(function() {document.getElementById('alertTriggerLink').click();},200);", Root);
                Assert.That(Driver.Title(popUp), Is.EqualTo("Pop Up Window"));

                System.Threading.Thread.Sleep(1000);
                Driver.AcceptModalDialog(Root);
                Driver.HasDialog("You have triggered a alert and this is the text.", Root).should_be_false();
            }
        }
        public void Finds_scope_first_for_alerts()
        {
            using (Driver)
            {
                Driver.Click(Driver.FindLink("Open pop up window", Root));
                var popUp = new DriverScope(new SessionConfiguration(), new WindowFinder(Driver, "Pop Up Window", Root), Driver, null, null, null);
                Assert.That(Driver.HasContent("I am a pop up window", popUp), Is.True);

                Driver.ExecuteScript("window.setTimeout(function() {document.getElementById('alertTriggerLink').click();},500);", Root);
                Assert.That(Driver.HasContent("I am a pop up window", popUp), Is.True);
                Driver.ExecuteScript("self.close();", popUp);

                System.Threading.Thread.Sleep(500);
                Driver.AcceptModalDialog(Root);
                Driver.HasDialog("You have triggered a confirm and this is the text.", Root).should_be_false();
            }
        }
Exemple #10
0
 public override void Act()
 {
     Driver.AcceptModalDialog(driverScope);
 }
Exemple #11
0
 /// <summary>
 /// Accept the first modal dialog to appear within the <see cref="Configuration.Timeout"/>
 /// </summary>
 /// <exception cref="T:Coypu.MissingHtmlException">Thrown if the dialog cannot be found</exception>
 public void AcceptModalDialog()
 {
     RetryUntilTimeout(() => driver.AcceptModalDialog());
 }