Skip to content

Instantly share code, notes, and snippets.

View IsmagilovQA's full-sized avatar

Vitaliy IsmagilovQA

  • Brightgrove LTD
  • Kharkiv, Ukraine
View GitHub Profile
@IsmagilovQA
IsmagilovQA / gist:979b72bf50a4445c750f55e4efe34e0f
Created January 5, 2022 15:00
Selenide | Scrolling via JavaScript
Скролл в самый верх делаю таким способом -
executeJavaScript("$(document).scrollTop(0)", "");
Скролл в самый низ делаю таким способом -
window.scrollTo(0,document.body.scrollHeight);
@IsmagilovQA
IsmagilovQA / gist:3e7c6aeddcd0b103d2155a23d8c61a5a
Last active January 5, 2022 15:07
Selenium | Open new tab via Keys and JavaScript
Option 1: driver.FindElement(By.CssSelector("body")).SendKeys(Keys.LeftControl + "T");
Option 2: String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,"t");
Option 3: executeJavaScript("window.open()");
Option 4: driver.switchTo().window(new ArrayList<>(WebDriverRunner.getWebDriver().getWindowHandles()).get(numberTab - 1));
@IsmagilovQA
IsmagilovQA / gist:a3c702517b13ca8e5ec433234983e8ef
Created November 8, 2022 14:53
Selenide - custom conditions
https://github.com/selenide/selenide/wiki/Custom-conditions#moving
@IsmagilovQA
IsmagilovQA / gist:82825bff66f0a9143d79409264bac17c
Created November 8, 2022 14:55
Selenide - custom condition: textIgnoreSpaces
public static Condition textIgnoreSpaces(String text) {
return new Condition("text with spaces" + text) {
@Override
@Nonnull
public CheckResult check(Driver driver, WebElement element) {
String textWithSpaces = element.getText();
return new CheckResult(textWithSpaces.replaceAll("\\s+", "").equals(text), textWithSpaces);
}
};
}