This page is hosted for free by zzz.com.ua, if you are owner of this page, you can remove this message and gain access to many additional features by upgrading your hosting to PRO or VIP for just 41.60 UAH.
Do you want to support owner of this site? Click here and donate to his account some amount, he will be able to use it to pay for any of our services, including removing this ad.

Most interesting examples of code

Example of using method getCookies()

    public static void get_cookies() {

        try {
            all_cookie=driver.manage().getCookies();//getting all cookies
            all_cookie.toArray();// convert cookies to array
            if (all_cookie.contains("subscribePopUP=1")) subscription_added = true;//searching of needed record
        }
        catch (NullPointerException e){
            e.printStackTrace();
        }
}
To view all code view my git

Wait in seconds method

public static void waitInSeconds (int seconds)
    {
        try {
            Thread.sleep(1000*seconds);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

Hover and scroll

    public static Services get_request_from_services_page()
    {
        JavascriptExecutor jse = (JavascriptExecutor)driver;
        jse.executeScript("scroll(0,3500);");//Scroll down
        try {
            WebElement send_hover = driver.findElement(By.xpath(Variables.SEND_SERVICES_FORM.toString()));
            ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", send_hover);//hover on 
            send.click();
        }
        catch (ElementNotVisibleException e)
        {
            Assert.fail("button is not visible it is impossible to hover on it");
        }