Skip to content

Commit

Permalink
added new dependency auto-browser for experiment with auto-type the u…
Browse files Browse the repository at this point in the history
…ser and password
  • Loading branch information
astrapi69 committed Jul 19, 2023
1 parent d4123ff commit 078f4f4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ resourcebundleCoreVersion=5
resourceViewmodelVersion=6
jobjClonerVersion=2
lGoodDatePickerVersion=11.2.1
autoBrowserVersion=2.0.6
##############################
# test dependencies versions #
##############################
Expand Down
2 changes: 2 additions & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ dependencies {
implementation("com.github.lgooddatepicker:LGoodDatePicker:$lGoodDatePickerVersion")
implementation("io.github.astrapi69:tree-api:$treeApiVersion")
implementation("io.github.astrapi69:jobj-cloner:$jobjClonerVersion")
implementation("org.kquiet:auto-browser:$autoBrowserVersion")


testImplementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.github.astrapi69.mystic.crypt.autotype;

import org.kquiet.browser.*;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;

import java.util.List;
import static org.openqa.selenium.support.ui.ExpectedConditions.*;

public class Sample
{
public static void main(String args[]) throws Exception
{
try (ActionRunner actionRunner = new BasicActionRunner())
{
ActionComposer actionComposer = new ActionComposerBuilder().prepareActionSequence()
.getUrl("https://github.com/login")
.waitUntil(elementToBeClickable(By.id("login_field")), 3000)
.sendKey(By.id("login_field"), "foo")
.waitUntil(elementToBeClickable(By.id("password")), 3000)
.sendKey(By.id("password"), "bar")
.waitUntil(elementToBeClickable(By.cssSelector("input[type='submit']")), 3000)
.prepareClick(By.cssSelector("input[type='submit']")).done()
.returnToComposerBuilder().buildBasic().setCloseWindow(false)
.onFail(ac -> System.out
.println("called when an exception is thrown or is marked as failed"))
.onDone(ac -> System.out
.println("always called after all browser actions and callbacks"));
actionRunner.executeComposer(actionComposer).get();
// while (true)
// {
// Thread.sleep(1000);
// }
}
}

}

0 comments on commit 078f4f4

Please sign in to comment.