All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codeborne.selenide.WebDriverConditions Maven / Gradle / Ivy

The newest version!
package com.codeborne.selenide;

import com.codeborne.selenide.conditions.webdriver.CookieWithName;
import com.codeborne.selenide.conditions.webdriver.CookieWithNameAndValue;
import com.codeborne.selenide.conditions.webdriver.CurrentFrameUrl;
import com.codeborne.selenide.conditions.webdriver.CurrentFrameUrlContaining;
import com.codeborne.selenide.conditions.webdriver.CurrentFrameUrlStartingWith;
import com.codeborne.selenide.conditions.webdriver.NumberOfWindows;
import com.codeborne.selenide.conditions.webdriver.Title;
import com.codeborne.selenide.conditions.webdriver.Url;
import com.codeborne.selenide.conditions.webdriver.UrlContaining;
import com.codeborne.selenide.conditions.webdriver.UrlStartingWith;
import org.openqa.selenium.WebDriver;

public class WebDriverConditions {
  public static ObjectCondition url(String expectedUrl) {
    return new Url(expectedUrl);
  }

  public static ObjectCondition urlStartingWith(String expectedUrl) {
    return new UrlStartingWith(expectedUrl);
  }

  public static ObjectCondition urlContaining(String expectedUrl) {
    return new UrlContaining(expectedUrl);
  }

  public static ObjectCondition currentFrameUrl(String expectedUrl) {
    return new CurrentFrameUrl(expectedUrl);
  }

  public static ObjectCondition currentFrameUrlStartingWith(String expectedUrl) {
    return new CurrentFrameUrlStartingWith(expectedUrl);
  }

  public static ObjectCondition currentFrameUrlContaining(String expectedUrl) {
    return new CurrentFrameUrlContaining(expectedUrl);
  }

  /**
   * Check that the number of windows/tabs in the browser is as expected.
   * Example:
   * 
   * {@code webdriver().shouldHave(numberOfWindows(2)) }
   * 
*/ public static ObjectCondition numberOfWindows(int numberOfWindows) { return new NumberOfWindows(numberOfWindows); } public static ObjectCondition title(String expectedTitle) { return new Title(expectedTitle); } public static ObjectCondition cookie(String name) { return new CookieWithName(name); } public static ObjectCondition cookie(String name, String value) { return new CookieWithNameAndValue(name, value); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy