Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97762

How to make Selenide test a bit slower for the sake of its stability

$
0
0

Selenide/Selenium Experts

How do I slow down Selenide tests to improve stability?

I override the default implicit waiting used by Selenide to try to have more predictable tests. Tests results are extremely unpredictable: incorrect searching of DOM elements but in debug mode they are always passed.

Test driver settings looks like

@BeforeAll
static void initDriver() {
    System.setProperty("webdriver....");
    Configuration.browser = "chrome";
    Configuration.timeout = 10_000L;//overriding
    Configuration.pageLoadStrategy = "normal";
    ...setting ChromeOptions
    driver = new ChromeDriver(options);

}

@Test
public void testLogin() {
    driver.get(url);
    setWebDriver(driver);
    // simple searching (byName) works fine
    $(By.name("username")).shouldBe(exist);
    $(By.name("username")).sendKeys("username");
    $(By.name("password")).shouldBe(exist);
    $(By.name("password")).sendKeys("password");
    //Any searching (byXpath) works unstable
    $(By.xpath("//*[@id=\"window\"]/div/div[3]/div[1]/div[1]/div/div[1]/input")).shouldBe(exist);
    $(By.xpath("//*[@id=\"window\"]/div/div[3]/div[1]/div[1]/div/div[1]/input")).sendKeys("PRODUCT");//bad pattern to re-run searching

}

Viewing all articles
Browse latest Browse all 97762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>