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

com.xlrit.gears.runner.runnertarget.selenide.SlowSelenideFacade Maven / Gradle / Ivy

The newest version!
package com.xlrit.gears.runner.runnertarget.selenide;

import com.codeborne.selenide.SelenideElement;
import com.xlrit.gears.runner.graphql.GraphQLClient;
import com.xlrit.gears.runner.driver.RunConfig;
import com.xlrit.gears.runner.runnertarget.RunnerContext;
import lombok.SneakyThrows;

public class SlowSelenideFacade extends AbstractSelenideFacade {
    public int typeMillis;
    public int clickMillis;

    public SlowSelenideFacade(RunConfig config, RunnerContext context, GraphQLClient client) {
        super(config, context, client);
        typeMillis = config.typeMillis;
        clickMillis = config.clickMillis;
    }

    @SneakyThrows
    @Override
    public void type(String value, SelenideElement input) {
        input.scrollIntoView("{behavior: \"smooth\", block: \"center\", inline: \"center\"}");

        for (char c : value.toCharArray()) {
            input.sendKeys(Character.toString(c));
            waitFor(typeMillis);
        }
    }

    @SneakyThrows
    @Override
    public void pressButton(SelenideElement button) {
        button.scrollIntoView("{behavior: \"smooth\", block: \"center\", inline: \"center\"}")
                .hover();
        waitFor(clickMillis);
        button.click();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy