This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chromePrefs.put(BROWSER_NOTIFICATIONS, DISABLED); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final PROFILE_DIRECTORY = insert_your_path_here | |
@Override | |
public WebDriver getDefaultDriver() { | |
File profileDirectory = new File(PROFILE_DIRECTORY); | |
FirefoxProfile profile = new FirefoxProfile(profileDirectory); | |
profile.setAcceptUntrustedCertificates(true); | |
profile.setPreference("browser.startup.homepage", "www.google.pl"); | |
return new FirefoxDriver(profile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread.sleep(3000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebDriverWait wait = new WebDriverWait(getDriver(), 5, 500); | |
wait.until(not(presenceOfElementLocated(By.id("disappearingelement")))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
driver.manage().timeouts.implicitWait(10,TimeUnit.SECONDS); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Predicate<WebDriver> loadingElementDisappeared = new Predicate<WebDriver>() { | |
public boolean apply(WebDriver driver) { | |
return driver.findElements(By.id("disappearingelement")).size() = 0; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wait.until(loadingElementDisappeared); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) | |
.withTimeout(5, TimeUnit.SECONDS) | |
.pollingEvery(500, TimeUnit.MILLISECONDS) | |
.ignoring(NoSuchElementException.class) | |
.withMessage("Oops, element didn't disappear!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void verifySuccessfulLogin() { | |
await().until(WAITER_SELECTOR_AFTER_LOGIN).areDisplayed(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Predicate<Fluent> ajaxCallCompleted = new Predicate<Fluent>() { | |
@Override | |
public boolean apply(Fluent fluent) { | |
return (Boolean) ((JavascriptExecutor) getDriver()).executeScript("return (window.jQuery != null) && (jQuery.active === 0);"); | |
} | |
} | |
private static final String URL = "https://resttesttest.com/"; | |
private static final String SUCCESS_TEXT = "HTTP 200 OK"; | |