This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "google-sample-test", | |
"version": "1.0.0", | |
"description": "a sample selenium 4 with js ", | |
"main": "googleSearchTest.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Shama Ugale", | |
"license": "ISC", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'java' | |
} | |
group 'SeleniumGradleSample' | |
version '1.0-SNAPSHOT' | |
sourceCompatibility = 1.8 | |
repositories { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>selenium4</groupId> | |
<artifactId>selenium4</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<build> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, Object> args = new HashMap<>(); | |
args.put("direction", "up"); | |
driver.executeScript("mobile: swipe", args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MobileElement source = (MobileElement) new WebDriverWait(driver, 30) | |
.until(elementToBeClickable(MobileBy.AccessibilityId("slider"))); | |
driver.addCommand(HttpMethod.POST, String.format("/session/%s/plugin/actions/swipe", driver.getSessionId()), "swipe"); | |
driver.execute("swipe", ImmutableMap.of("elementId", source.getId(), "percentage", 50)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MobileElement slider = driver.findElementByAccessibilityId("slider"); | |
Point source = slider.getLocation(); | |
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger"); | |
Sequence sequence = new Sequence(finger, 1); | |
sequence.addAction(finger.createPointerMove(ofMillis(0), | |
PointerInput.Origin.viewport(), source.x, source.y)); | |
sequence.addAction(finger.createPointerDown(PointerInput.MouseButton.MIDDLE.asArg())); | |
sequence.addAction(new Pause(finger, ofMillis(600))); | |
sequence.addAction(finger.createPointerMove(ofMillis(600), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String apiKey = System.getenv("APPLITOOLS_API_KEY"); | |
eyes.setApiKey(apiKey); | |
String batchName = null; | |
String batchId = System.getenv("APPLITOOLS_BATCH_ID"); | |
BatchInfo batchInfo = new BatchInfo(batchName); | |
batchInfo.setId(batchId); | |
eyes.setBatch(batchInfo); | |
eyes.setForceFullPageScreenshot(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>com.applitools</groupId> | |
<artifactId>eyes-appium-java3</artifactId> | |
<version>RELEASE</version> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.appium.java_client.AppiumDriver; | |
import io.appium.java_client.MobileElement; | |
import io.appium.java_client.android.AndroidDriver; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.support.ui.ExpectedConditions; | |
import org.openqa.selenium.support.ui.WebDriverWait; | |
import org.testng.Assert; | |
import org.testng.annotations.AfterTest; | |
import org.testng.annotations.BeforeTest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | |
<suite name="Suite" parallel="tests"> | |
<test name="Android"> | |
<classes> | |
<class name="FirstAndroidTest"/> | |
</classes> | |
</test> | |
</suite> |