Skip to content

evpl/selenide-hacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenide hacks

The set of Selenide hacks

Maven Central Javadoc License Hits-of-Code Lines of code

Table of Contents

How to use

Requires Java 8+ version. Just add Selenide and Selenide hacks dependencies (versions correspond to the Selenide version).

API

CustomArgsCommand

The Selenide Command with custom arguments. You can use CustomArgsCommand.of(Command, Object[]) method or CustomArgsCommandOf(Command, Object[]) constructor.

SelenideElement element = driver.$(".class_name");

element.execute(
    CustomArgsCommand.of(new Append(), "text to append"),
    Duration.ofSeconds(20)
);

UnsafeSelenideElement

Represents an object that provides access to SelenideElement by method name and method arguments. You can use UnsafeSelenideElement.of(SelenideElement) method or UnsafeSelenideElementOf(SelenideElement) constructor.

SelenideElement element = driver.$(".class_name");

/* The first way */
UnsafeSelenideElement.of(element).invoke("append", "text to append");

/* The second way */
UnsafeSelenideElement.of(element).invoke(
    "execute",
    CustomArgsCommand.of(new Append(), "text to append"),
    Duration.ofSeconds(20)
);

/* The third way */
UnsafeSelenideElement.of(element).invoke("append", "text to append", Duration.ofSeconds(20));

OuterCommand

Represents Command that can be executed on an SelenideElement. You can use OuterCommand.of(String, Object[]) and OuterCommand.of(Command, Object[]) methods or OuterCommandOf(String, Object[]) and OuterCommandOf(Command, Object[]) constructor.

SelenideElement element = driver.$(".class_name");

/* The first way */
OuterCommand.of("append", "text to append").executeOn(element);

/* The second way */
OuterCommand.of(
    "execute",
    CustomArgsCommand.of(new Append(), "text to append"),
    Duration.ofSeconds(20)
).executeOn(element);

/* The third way */
OuterCommand.of("append", "text to append", Duration.ofSeconds(20)).executeOn(element);