Best io.appium code snippet using io.appium.java_client.serverevents.CustomEvent
iOSInAppAuthenticationTest.java
Source:iOSInAppAuthenticationTest.java
...4import io.appium.java_client.ios.IOSDriver;5import io.appium.java_client.remote.AutomationName;6import io.appium.java_client.remote.IOSMobileCapabilityType;7import io.appium.java_client.remote.MobileCapabilityType;8import io.appium.java_client.serverevents.CustomEvent;9import io.appium.java_client.serverevents.ServerEvents;10import lombok.SneakyThrows;11import org.openqa.selenium.By;12import org.openqa.selenium.remote.DesiredCapabilities;13import org.openqa.selenium.support.ui.ExpectedConditions;14import org.openqa.selenium.support.ui.WebDriverWait;15import org.testng.annotations.AfterClass;16import org.testng.annotations.BeforeClass;17import org.testng.annotations.Test;18import java.io.File;19import java.io.IOException;20import java.net.URL;21public class iOSInAppAuthenticationTest {22 private IOSDriver driver;23 private WebDriverWait wait;24 private By loginButton = MobileBy.AccessibilityId("Log In");25 private By logoutButton = MobileBy.AccessibilityId("Log Out");26 @BeforeClass27 public void setUp() throws IOException {28 DesiredCapabilities capabilities = new DesiredCapabilities();29 capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "13.3");30 capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 11 Pro Max");31 capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);32 capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 700000);33 capabilities.setCapability(IOSMobileCapabilityType.USE_PREBUILT_WDA, true);34 capabilities.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir") + "/apps/BiometricLogin.app");35 driver = new IOSDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);36 wait = new WebDriverWait(driver, 20);37 }38 @Test39 public void inAppAuthenticationTest() {40 CustomEvent logEvent = new CustomEvent();41 driver.executeScript("mobile:enrollBiometric", ImmutableMap.of("isEnabled", true));42 logEvent.setVendor("VodQA");43 logEvent.setEventName("onLoginScreen");44 driver.logEvent(logEvent);45 wait.until(ExpectedConditions.presenceOfElementLocated(loginButton)).click();46 logEvent.setEventName("loggedIn");47 driver.switchTo().alert().accept();48 driver.logEvent(logEvent);49 driver.executeScript("mobile:sendBiometricMatch", ImmutableMap.of("type", "faceId", "match", true));50 wait.until(ExpectedConditions.presenceOfElementLocated(logoutButton)).click();51 wait.until(ExpectedConditions.presenceOfElementLocated(loginButton)).click();52 driver.executeScript("mobile:sendBiometricMatch", ImmutableMap.of("type", "faceId", "match", false));53 wait.until(ExpectedConditions.alertIsPresent());54 }55 @SneakyThrows56 @AfterClass57 public void afterClass() {58 if (driver != null) {59 CustomEvent customEvent = new CustomEvent();60 customEvent.setVendor("VodQA");61 customEvent.setEventName("event ends here");62 driver.logEvent(customEvent);63 ServerEvents events = driver.getEvents();64 events.save(new File(System.getProperty("user.dir") + "/eventFlow.json").toPath());65 driver.quit();66 }67 }68}...
Logs_event.java
Source:Logs_event.java
...7import org.openqa.selenium.support.ui.ExpectedConditions;8import org.openqa.selenium.support.ui.WebDriverWait;9import io.appium.java_client.MobileBy;10import io.appium.java_client.ios.IOSDriver;11import io.appium.java_client.serverevents.CustomEvent;12import io.appium.java_client.serverevents.ServerEvents;13import io.appium.java_client.service.local.AppiumDriverLocalService;14import io.appium.java_client.service.local.AppiumServiceBuilder;15public class Logs_event16{17 public static void main(String[] args) throws Exception18 {19 //Start Appium server programmatically20 AppiumServiceBuilder sb=new AppiumServiceBuilder();21 sb.usingAnyFreePort();22 sb.usingDriverExecutable(new File("/usr/local/bin/node"));23 sb.withAppiumJS(new File("/usr/local/bin/appium"));24 HashMap<String,String> ev=new HashMap<>();25 ev.put("PATH","/usr/local/bin:"+System.getenv("PATH"));26 sb.withEnvironment(ev);27 AppiumDriverLocalService as=AppiumDriverLocalService.buildService(sb);28 as.start();29 //Provide capabilities related to Simulator and App30 DesiredCapabilities dc=new DesiredCapabilities();31 dc.setCapability("platformName", "iOS");32 dc.setCapability("platformVersion", "13.5");33 dc.setCapability("deviceName", "iPhone 8");34 dc.setCapability("app","https://github.com/cloudgrey-io/the-app/releases/download/v1.10.0/TheApp-v1.10.0.app.zip");35 //Launch app and do login36 IOSDriver driver=new IOSDriver(as.getUrl(),dc);37 CustomEvent evt=new CustomEvent();38 evt.setVendor("theApp"); //app name39 try40 {41 WebDriverWait wait=new WebDriverWait(driver,20);42 wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Login Screen"))).click();43 evt.setEventName("go to Login screen");44 driver.logEvent(evt);45 wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@label='username']"))).sendKeys("alice"); 46 evt.setEventName("userid entered");47 driver.logEvent(evt);48 wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@label='password']"))).sendKeys("mypassword"); 49 evt.setEventName("password entered");50 driver.logEvent(evt);51 wait.until(ExpectedConditions.elementToBeClickable(By.xpath("(//*[@label='loginBtn'])[2]"))).click(); ...
LogsEvents.java
Source:LogsEvents.java
...17import static io.appium.java_client.MobileCommand.GET_EVENTS;18import static io.appium.java_client.MobileCommand.LOG_EVENT;19import com.google.common.collect.ImmutableMap;20import io.appium.java_client.serverevents.CommandEvent;21import io.appium.java_client.serverevents.CustomEvent;22import io.appium.java_client.serverevents.TimedEvent;23import io.appium.java_client.serverevents.ServerEvents;24import java.util.List;25import java.util.Map;26import java.util.stream.Collectors;27import org.openqa.selenium.json.Json;28import org.openqa.selenium.remote.Response;29public interface LogsEvents extends ExecutesMethod {30 /**31 * Log a custom event on the Appium server.32 *33 * @since Appium 1.1634 * @param event the event to log35 * @throws org.openqa.selenium.WebDriverException if there was a failure while executing the script36 */37 default void logEvent(CustomEvent event) {38 execute(LOG_EVENT, ImmutableMap.of("vendor", event.getVendor(), "event", event.getEventName()));39 }40 /**41 * Log a custom event on the Appium server.42 *43 * @since Appium 1.1644 * @return ServerEvents object wrapping up the various command and event timestamps45 * @throws org.openqa.selenium.WebDriverException if there was a failure while executing the script46 */47 default ServerEvents getEvents() {48 Response response = execute(GET_EVENTS);49 String jsonData = new Json().toJson(response.getValue());50 //noinspection unchecked51 Map<String, Object> value = (Map<String, Object>) response.getValue();...
Edition094_Events_API.java
Source:Edition094_Events_API.java
1import io.appium.java_client.MobileBy;2import io.appium.java_client.ios.IOSDriver;3import io.appium.java_client.serverevents.CustomEvent;4import io.appium.java_client.serverevents.ServerEvents;5import java.io.File;6import java.io.IOException;7import java.net.MalformedURLException;8import java.net.URL;9import org.junit.After;10import org.junit.Before;11import org.junit.Test;12import org.openqa.selenium.By;13import org.openqa.selenium.remote.DesiredCapabilities;14import org.openqa.selenium.support.ui.ExpectedConditions;15import org.openqa.selenium.support.ui.WebDriverWait;16public class Edition094_Events_API {17 private String APP = "https://github.com/cloudgrey-io/the-app/releases/download/v1.10.0/TheApp-v1.10.0.app.zip";18 private By loginScreen = MobileBy.AccessibilityId("Login Screen");19 private By loginBtn = MobileBy.AccessibilityId("loginBtn");20 private By username = MobileBy.AccessibilityId("username");21 private By password = MobileBy.AccessibilityId("password");22 private By loggedIn = MobileBy.xpath("//*[@label='You are logged in as alice']");23 private IOSDriver driver;24 @Before25 public void setUp() throws MalformedURLException {26 DesiredCapabilities capabilities = new DesiredCapabilities();27 capabilities.setCapability("platformName", "iOS");28 capabilities.setCapability("platformVersion", "11.4");29 capabilities.setCapability("deviceName", "iPhone X");30 capabilities.setCapability("app", APP);31 driver = new IOSDriver<>(new URL("http://localhost:4723/wd/hub"), capabilities);32 }33 @After34 public void tearDown() throws IOException {35 if (driver != null) {36 CustomEvent evt = new CustomEvent();37 evt.setVendor("theApp");38 evt.setEventName("testEnd");39 driver.logEvent(evt);40 ServerEvents events = driver.getEvents();41 events.save(new File("/Users/jlipps/Desktop/java.json").toPath());42 driver.quit();43 }44 }45 @Test46 public void testLogin() {47 WebDriverWait wait = new WebDriverWait(driver, 5);48 wait.until(ExpectedConditions.presenceOfElementLocated(loginScreen)).click();49 CustomEvent evt = new CustomEvent();50 evt.setVendor("theApp");51 evt.setEventName("onLoginScreen");52 driver.logEvent(evt);53 String AUTH_USER = "alice";54 wait.until(ExpectedConditions.presenceOfElementLocated(username)).sendKeys(AUTH_USER);55 String AUTH_PASS = "wrongpassword";56 wait.until(ExpectedConditions.presenceOfElementLocated(password)).sendKeys(AUTH_PASS);57 wait.until(ExpectedConditions.presenceOfElementLocated(loginBtn)).click();58 wait.until(ExpectedConditions.presenceOfElementLocated(loggedIn));59 evt.setEventName("loggedIn");60 driver.logEvent(evt);61 }62}...
LogEventTest.java
Source:LogEventTest.java
...16package io.appium.java_client.android;17import static org.junit.Assert.assertThat;18import static org.junit.Assert.assertTrue;19import io.appium.java_client.serverevents.CommandEvent;20import io.appium.java_client.serverevents.CustomEvent;21import io.appium.java_client.serverevents.TimedEvent;22import io.appium.java_client.serverevents.ServerEvents;23import org.hamcrest.Matchers;24import org.junit.Test;25public class LogEventTest extends BaseAndroidTest {26 @Test27 public void verifyLoggingCustomEvents() {28 CustomEvent evt = new CustomEvent();29 evt.setEventName("funEvent");30 evt.setVendor("appium");31 driver.logEvent(evt);32 ServerEvents events = driver.getEvents();33 boolean hasCustomEvent = events.events.stream().anyMatch((TimedEvent event) ->34 event.name.equals("appium:funEvent") &&35 event.occurrences.get(0).intValue() > 036 );37 boolean hasCommandName = events.commands.stream().anyMatch((CommandEvent event) ->38 event.name.equals("logCustomEvent")39 );40 assertTrue(hasCustomEvent);41 assertTrue(hasCommandName);42 assertThat(events.jsonData, Matchers.containsString("\"appium:funEvent\""));43 }44}...
Logs_Print.java
Source:Logs_Print.java
...3import org.openqa.selenium.remote.CapabilityType;4import org.openqa.selenium.remote.DesiredCapabilities;5import io.appium.java_client.android.Activity;6import io.appium.java_client.android.AndroidDriver;7import io.appium.java_client.serverevents.CustomEvent;8public class Logs_Print9{10 public static void main(String[] args) throws Exception11 {12 //start appium server13 Runtime.getRuntime().exec("cmd.exe /c start cmd.exe /k \"appium\"");14 URL u=new URL("http://0.0.0.0:4723/wd/hub");15 //define desired capabilities16 DesiredCapabilities dc=new DesiredCapabilities();17 dc.setCapability(CapabilityType.BROWSER_NAME,"");18 dc.setCapability("deviceName","emulator-5554");19 dc.setCapability("platformName","android");20 dc.setCapability("platformVersion","8.1.0");21 dc.setCapability("appPackage","com.vodqareactnative");22 dc.setCapability("appActivity","com.vodqareactnative.MainActivity");23 //launch app in device through appium server by creating driver object24 AndroidDriver driver;25 while(2>1)26 {27 try28 {29 driver=new AndroidDriver(u,dc);30 break;31 }32 catch(Exception ex)33 {34 35 }36 37 }38 //Test automation39 CustomEvent evt=new CustomEvent();40 evt.setVendor("vodQA");41 try42 {43 Thread.sleep(10000);44 Activity ac=new Activity("com.soumyasethy.smstoast","com.soumyasethy.smstoast.SMSToast");45 driver.startActivity(ac);46 Thread.sleep(5000);47 driver.launchApp();48 }49 catch(Exception ex)50 {51 evt.setEventName(ex.getMessage());52 }53 //close app...
TapMethods.java
Source:TapMethods.java
...7import io.appium.java_client.LogsEvents;8import io.appium.java_client.MobileElement;9import io.appium.java_client.TouchAction;10import io.appium.java_client.android.AndroidDriver;11import io.appium.java_client.serverevents.CustomEvent;12import io.appium.java_client.touch.TapOptions;13import io.appium.java_client.touch.offset.ElementOption;14import io.appium.java_client.touch.offset.PointOption;15public class TapMethods {16 public static void main(String[] args) throws MalformedURLException, InterruptedException {17 DesiredCapabilities des =new DesiredCapabilities();18 des.setCapability("deviceName", "Gionee S6s");19 //des.setCapability("udid", "PF7T5PKFP7QCF6WS");20 des.setCapability("platformName", "Android");21 des.setCapability("platformVersion", "7.0");22 des.setCapability("appPackage", "com.android.mms");23 des.setCapability("appActivity", "com.android.mms.ui.ComposeMessageActivity");24 URL url=new URL("http://127.0.0.1:4723/wd/hub");25 AndroidDriver<MobileElement> driver=new AndroidDriver<MobileElement>(url,des);...
CustomEvent.java
Source:CustomEvent.java
1package io.appium.java_client.serverevents;2import lombok.Data;3@Data4public class CustomEvent {5 private String vendor;6 private String eventName;7}...
CustomEvent
Using AI Code Generation
1import io.appium.java_client.serverevents.CustomEvent;2import io.appium.java_client.serverevents.EventFiringWebDriverFactory;3import io.appium.java_client.serverevents.ServerEvents;4import org.openqa.selenium.WebDriver;5import org.openqa.selenium.remote.DesiredCapabilities;6import org.openqa.selenium.remote.RemoteWebDriver;7import java.net.URL;8import java.util.concurrent.TimeUnit;9import java.util.logging.Level;10import java.util.logging.Logger;11public class Appium {12 public static void main(String[] args) throws Exception {13 DesiredCapabilities capabilities = new DesiredCapabilities();14 capabilities.setCapability("browserName", "");15 capabilities.setCapability("platformName", "Android");16 capabilities.setCapability("deviceName", "emulator-5554");17 capabilities.setCapability("platformVersion", "8.0");18 capabilities.setCapability("appPackage", "com.google.android.calculator");19 capabilities.setCapability("appActivity", "com.android.calculator2.Calculator");
CustomEvent
Using AI Code Generation
1import io.appium.java_client.serverevents.CustomEvent;2import io.appium.java_client.serverevents.EventListener;3import io.appium.java_client.events.EventFiringWebDriver;4import io.appium.java_client.events.EventFiringWebDriverFactory;5import io.appium.java_client.events.api.general.AppiumWebDriverEventListener;6import io.appium.java_client.events.api.general.WebDriverEventListener;7import io.appium.java_client.events.api.mobile.MobileDriverEventListener;8import io.appium.java_client.events.api.mobile.MobileElementEventListener;9import io.appium.java_client.events.api.touch.TouchEventFiringWebDriver;10import io.appium.java_client.events.api.touch.TouchEventListener;11import io.appium.java_client.events.EventFiringWebDriver;12import io.appium.java_client.events.EventFiringWebDriverFactory;13import io.appium.java_client.events.api.general.AppiumWebDriverEventListener;14import io.appium.java_client.events.api.general.WebDriverEventListener;15import io.appium.java_client.events.api.mobile.MobileDriverEventListener;16import io.appium.java_client.events.api.mobile.MobileElementEventListener;
CustomEvent
Using AI Code Generation
1import io.appium.java_client.serverevents.CustomEvent;2import io.appium.java_client.serverevents.CustomEvent.CustomEventBuilder;3import io.appium.java_client.serverevents.ServerEvents;4import io.appium.java_client.serverevents.ServerEventsListener;5import org.openqa.selenium.remote.DesiredCapabilities;6import org.testng.annotations.AfterTest;7import org.testng.annotations.BeforeTest;8import org.testng.annotations.Test;9import java.io.File;10import java.net.URL;11import java.util.concurrent.TimeUnit;12import io.appium.java_client.AppiumDriver;13import io.appium.java_client.MobileElement;14import io.appium.java_client.android.AndroidDriver;15public class AppiumTest {16 AppiumDriver driver;17 ServerEvents serverEvents;18 public void setUp() throws Exception {19 File classpathRoot = new File(System.getProperty("user.dir"));20 File appDir = new File(classpathRoot, "apps");21 File app = new File(appDir, "app-debug.apk");22 DesiredCapabilities capabilities = new DesiredCapabilities();23 capabilities.setCapability("deviceName", "Android Emulator");24 capabilities.setCapability("app", app.getAbsolutePath());
CustomEvent
Using AI Code Generation
1package appium;2import java.util.List;3import org.openqa.selenium.By;4import org.openqa.selenium.WebDriver;5import org.openqa.selenium.WebElement;6import org.openqa.selenium.remote.DesiredCapabilities;7import io.appium.java_client.AppiumDriver;8import io.appium.java_client.android.AndroidDriver;9import io.appium.java_client.events.api.general.AppiumWebDriverEventListener;10import io.appium.java_client.events.api.general.WebElementEventListener;11import io.appium.java_client.events.api.general.WindowEventListener;12import io.appium.java_client.events.api.mobile.ContextEventListener;13import io.appium.java_client.events.api.mobile.NetworkEventListener;14import io.appium.java_client.events.api.mobile.PerformanceDataEventListener;15import io.appium.java_client.events.api.mobile.ScreenRecordingEventListener;16import io.appium.java_client.events.api.mobile.TouchEventListener;17import io.appium.java_client.events.api.mobile.WebSocketEventListener;18import io.appium.java_client.events.api.mobile.orientation.OrientationEventListener;19import io.appium.java_client.events.api.mobile.settings.SettingsEventListener;20import io.appium.java_client.events.api.mobile.swipe.SwipeEventListener;21import io.appium.java_client.events.api.mobile.targetlocatable.TargetLocatableEventListener;22import io.appium.java_client.events.api.mobile.touch.TapEventListener;23import io.appium.java_client.events.api.mobile.touch.flick.FlickEventListener;24import io.appium.java_client.events.api.mobile.touch.longpress.LongPressEventListener;25import io.appium.java_client.events.api.mobile.touch.scroll.ScrollEventListener;26import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToEventListener;27import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToExactEventListener;28import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToExactTextEventListener;29import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToTextEventListener;30import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToTopEventListener;31import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToTopTextEventListener;32import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToTopTextsEventListener;33import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToTopWebElementEventListener;34import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToWebElementEventListener;35import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToWebElementsEventListener;36import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToWebElementsTextEventListener;37import io.appium.java_client.events.api.mobile.touch.scroll.ScrollToWebElementsTextsEventListener;38import io.appium.java_client.events.api
CustomEvent
Using AI Code Generation
1import io.appium.java_client.events.api.general.CustomEvent;2import io.appium.java_client.events.api.general.ServerEvents;3import io.appium.java_client.events.api.general.ServerEventsListener;4public class AppiumTest {5 public void test() {6 ServerEventsListener listener = new ServerEventsListener();7 ServerEvents events = new ServerEvents(listener);8 events.start();9 CustomEvent event = new CustomEvent("myCustomEvent", "myCustomEventValue");10 events.addEvent(event);11 events.stop();12 List<CustomEvent> customEvents = listener.getCustomEvents();13 Assert.assertEquals(1, customEvents.size());14 Assert.assertEquals("myCustomEvent", customEvents.get(0).getEventName());15 Assert.assertEquals("myCustomEventValue", customEvents.get(0).getEventValue());16 }17}18package com.mycompany.app;19import io.appium.java_client.AppiumDriver;20import io.appium.java_client.MobileElement;21import io.appium.java_client.android.AndroidDriver;22import org.junit.Assert;23import org.junit.Before;24import org.junit.Test;25import org.openqa.selenium.remote.DesiredCapabilities;26import java.net.MalformedURLException;27import java.net.URL;28public class AppiumTest {29 private AppiumDriver<MobileElement> driver;30 public void setUp() throws MalformedURLException {31 DesiredCapabilities desiredCapabilities = new DesiredCapabilities();32 desiredCapabilities.setCapability("deviceName", "Pixel_3_API_29");33 desiredCapabilities.setCapability("platformName", "Android");34 desiredCapabilities.setCapability("appPackage", "com.android.chrome");
CustomEvent
Using AI Code Generation
1driver.manage().logs().get("server").forEach(System.out::println);2driver.manage().logs().get("server").forEach(event -> {3 if (event instanceof CustomEvent) {4 System.out.println(((CustomEvent) event).getEventName());5 System.out.println(((CustomEvent) event).getEventMessage());6 }7});8driver.manage().logs().get("server").forEach(function (event) {9 if (event instanceof CustomEvent) {10 console.log(event.getEventName());11 console.log(event.getEventMessage());12 }13});14driver.logEvent(new CustomEvent("MyEvent", "MyMessage"));15driver.logEvent(new CustomEvent("MyEvent", "MyMessage"));16driver.manage().logs().get("server").forEach(event -> {17 if (event instanceof CustomEvent) {18 System.out.println(((CustomEvent) event).getEventName());19 }20});21driver.manage().logs().get("server").forEach(function (event) {22 if (event instanceof CustomEvent) {23 console.log(event.getEventName());24 }25});
CustomEvent
Using AI Code Generation
1CustomEvent customEvent = new CustomEvent("eventName", "eventData");2driver.logEvent(customEvent);3EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);4eventFiringWebDriver.register(new MyListener());5EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);6eventFiringWebDriver.register(new MyListener());7EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);8eventFiringWebDriver.register(new MyListener());9EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);10eventFiringWebDriver.register(new MyListener());11EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);12eventFiringWebDriver.register(new MyListener());13EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);14eventFiringWebDriver.register(new MyListener());15EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);16eventFiringWebDriver.register(new MyListener());17EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver);
CustomEvent
Using AI Code Generation
1package appium;2import java.net.URL;3import java.util.List;4import org.openqa.selenium.remote.DesiredCapabilities;5import io.appium.java_client.AppiumDriver;6import io.appium.java_client.android.AndroidDriver;7import io.appium.java_client.serverevents.CustomEvent;8import io.appium.java_client.serverevents.ServerEvents;9public class appiumjava {10 public static void main(String[] args) throws Exception {11 DesiredCapabilities caps = new DesiredCapabilities();12 caps.setCapability("platformName", "Android");13 caps.setCapability("platformVersion", "7.0");14 caps.setCapability("deviceName", "Android Emulator");15 caps.setCapability("appPackage", "com.android.calculator2");16 caps.setCapability("appActivity", "com.android.calculator2.Calculator");17 caps.setCapability("automationName", "UiAutomator2");
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!