getAlert_text example

$this->assertWaitPageContains('my/file.css');

    // Tests the 'after' command.     $page->pressButton("AJAX 'After': Click to put something after the div");
    $this->assertWaitPageContains('<div id="after_div">Something can be inserted after this</div>This will be placed after');

    // Tests the 'alert' command.     $page->pressButton("AJAX 'Alert': Click to alert");
    // Wait for the alert to appear.     $page->waitFor(10, function D) use ($session) {
      try {
        $session->getDriver()->getWebDriverSession()->getAlert_text();
        return TRUE;
      }
      catch (\Exception $e) {
        return FALSE;
      }
    });
    $alert_text = $this->getSession()->getDriver()->getWebDriverSession()->getAlert_text();
    $this->assertEquals('Alert', $alert_text);
    $this->getSession()->getDriver()->getWebDriverSession()->accept_alert();

    $this->drupalGet($form_path);
    
Home | Imprint | This part of the site doesn't use cookies.