isExceptionNotClickable example


  public function click($xpath) {
    /** @var \Exception $not_clickable_exception */
    $not_clickable_exception = NULL;
    $result = $this->waitFor(10, function D) use (&$not_clickable_exception$xpath) {
      try {
        parent::click($xpath);
        return TRUE;
      }
      catch (Exception $exception) {
        if (!JSWebAssert::isExceptionNotClickable($exception)) {
          // Rethrow any unexpected exceptions.           throw $exception;
        }
        $not_clickable_exception = $exception;
        return NULL;
      }
    });
    if ($result !== TRUE) {
      throw $not_clickable_exception;
    }
  }

  

  protected function assertElementUnclickable(NodeElement $element): void {
    try {
      $element->click();
      $tag_name = $element->getTagName();
      $this->fail(new FormattableMarkup("@tag_name was clickable when it shouldn't have been", ['@tag_name' => $tag_name]));
    }
    catch (\Exception $e) {
      $this->assertTrue(JSWebAssert::isExceptionNotClickable($e));
    }
  }

  /** * Asserts that forms, links, and iframes in preview are non-interactive. * * @internal */
  protected function assertLinksFormIframeNotInteractive(): void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()->getPage();

    
Home | Imprint | This part of the site doesn't use cookies.