generated from AppiumTestDistribution/appium-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hello!
We have stack
java 17
appium 3.2.0
JUnit
and I settings appium server
@Log4j2
@Getter
public class AppiumServer {
private AppiumDriverLocalService service;
public AppiumServer run(String url, String port) {
ServerLogLevel logLevel = getLaunchProperties().getServerLogs();
try {
AppiumServiceBuilder builder = new AppiumServiceBuilder()
.withArgument(new ServerArgument() {
@Override
public String getArgument() {
return "-ka";
}
}, "800")
.withArgument(USE_PLUGINS, "appium-interceptor")
.usingAnyFreePort()
.withArgument(ALLOW_INSECURE, "chromedriver_autodownload")
.withArgument(RELAXED_SECURITY)
.withIPAddress(url);
if (logLevel != null && !logLevel.equals(ServerLogLevel.NONE)) {
builder.withArgument(LOG_LEVEL, logLevel.logLevel());
}
AppiumDriverLocalService service = builder.build();
service.start();
if (logLevel == null || logLevel.equals(ServerLogLevel.NONE)) {
service.clearOutPutStreams();
}
log.info("Appium Server is running on port: " + service.getUrl());
if (!service.isRunning()) {
throw new AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!");
}
this.service = service;
return this;
} catch (Exception e) {
throw new AppiumServerHasNotBeenStartedLocallyException("Something went wrong during run appium server: " + e);
}
}
public void stop() {
service.stop();
log.info("Appium Server has been stopped");
}
}log appium
20:11:39.977 [ForkJoinPool-1-worker-1] INFO r.t.m.c.l.d.LocalMobileDriver:32 - Creating configuration for local device
[Appium] Attempting to load plugin appium-interceptor...
[Appium] Requiring plugin at /Users/u_m1asj/.appium/node_modules/appium-interceptor/lib/index.js
[Appium] AppiumInterceptorPlugin has been successfully loaded in 0.340s
[Appium] Welcome to Appium v3.2.0 (REV 179d45050be0a71fd57591b0ed8aedf9b177ba10)
[Appium] Non-default server args:
[Appium] { address: '127.0.0.1',
allowInsecure: [ 'chromedriver_autodownload' ],
keepAliveTimeout: 800,
port: 26687,
relaxedSecurityEnabled: true,
usePlugins: [ 'appium-interceptor' ] }
[Appium] Enabling relaxed security. All insecure features will be enabled unless explicitly disabled by --deny-insecure
[Appium] The autodetected Appium home path: /Users/u_m1asj/.appium
[Appium] Attempting to load driver uiautomator2...
[Appium] Attempting to load driver xcuitest...
[Appium] Requiring driver at /Users/u_m1asj/.appium/node_modules/appium-uiautomator2-driver/build/lib/index.js
[Appium] Requiring driver at /Users/u_m1asj/.appium/node_modules/appium-xcuitest-driver/build/lib/index.js
[Appium] AndroidUiautomator2Driver has been successfully loaded in 0.385s
[Appium] XCUITestDriver has been successfully loaded in 0.881s
[Appium] Appium REST http interface listener started on http://127.0.0.1:26687
[Appium] Available drivers:
[Appium] - uiautomator2@6.8.2 (automationName 'UiAutomator2')
[Appium] - xcuitest@10.22.0 (automationName 'XCUITest')
[Appium] Available plugins:
[Appium] - appium-interceptor@1.0.3 (ACTIVE)
also settings capability
@Slf4j
public class AndroidCapabilities implements MobileCapabilities<UiAutomator2Options> {
private final AndroidPropertyProvider androidProperty = ParameterAccessor.getAndroidProperties();
private final LaunchPropertyProvider launchProperty = ParameterAccessor.getLaunchProperties();
@Override
public UiAutomator2Options getCapabilities(Device device, GridAddress gridAddress) {
UiAutomator2Options options = new UiAutomator2Options();
options.setAutomationName(androidProperty.getAutomationName())
.setUdid(device.getUdid())
.setNoReset(launchProperty.getNoReset())
.setFullReset(launchProperty.isFullReset())
.setIgnoreHiddenApiPolicyError(launchProperty.isIgnoreHiddenApiPolicyError())
.setUiautomator2ServerLaunchTimeout(Duration.ofSeconds(launchProperty.getUiautomator2ServerLaunchTimeout()))
.setAutoGrantPermissions(androidProperty.isAutoGrantPermissions())
.setClearSystemFiles(launchProperty.isClearSystemFiles())
.setNewCommandTimeout(Duration.ofSeconds(launchProperty.getNewCommandDuration()))
.clearDeviceLogsOnStart();
if (!device.getName().isEmpty()) {
options.setDeviceName(device.getName());
}
if (launchProperty.isInstallApp()) {
options.setApp(launchProperty.getAppPath());
} else {
options.setAppPackage(androidProperty.getFeatureAppPackage())
.setAppActivity(androidProperty.getAppActivity());
}
options.setCapability("appium:startProxyAutomatically", true); //start proxy
return options;
}
}but I get error after the test
@Test
@AllureId("197454")
@Tags({@Tag(IOS), @Tag(ANDROID)})
@DisplayName("Не самозанятый пользователь может переходить на экран Самозанятость с экрана профиля пользователя")
void unSmzUserEnterSmzFromUserProfileTest() throws IOException {
registerDefaultUser();
mobileAction.loadPage(mainPage)
.tap().onElement(mainPage.getProfileButton())
.loadPage(userProfilePage)
.swipe().toElement(userProfilePage.getRegistrationAndDocument(), TouchActions.Direction.UP, 3);
System.out.println("NETWORK DATA 1: " + getDriver().executeScript("interceptor: getInterceptedData"));
mobileAction.tap().onElement(userProfilePage.getRegistrationAndDocument())
.loadPage(selfEmployedPage)
.checkThatElement(selfEmployedPage.getSelfEmployedRegistration())
.isVisible("Элемент Регистрация самозанятого не отображается");
}
@AfterAll
static void tearDown() throws IOException {
//clearAllMocks();
System.out.println("NETWORK DATA 2: " + getDriver().executeScript("interceptor: getInterceptedData"));
}Proxy is not active for current session
Build info: version: '4.35.0', revision: '1c58e5028b'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '26.3', java.version: '17.0.9'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [2a5eca16-70ee-4b2a-93ba-10dae6a8012f, executeScript {args=[], script=interceptor: getInterceptedData}]
Capabilities {appium:app: /Users/u_m1asj/Downloads/al..., appium:appActivity: ru.alfabank.mobile.android...., appium:appPackage: ru.alfabank.mobile.android...., appium:autoGrantPermissions: false, appium:automationName: UiAutomator2, appium:clearDeviceLogsOnStart: true, appium:clearSystemFiles: true, appium:databaseEnabled: false, appium:desired: {app: /Users/u_m1asj/Downloads/al..., autoGrantPermissions: false, automationName: UiAutomator2, clearDeviceLogsOnStart: true, clearSystemFiles: true, fullReset: false, ignoreHiddenApiPolicyError: false, newCommandTimeout: 60, noReset: false, platformName: ANDROID, startProxyAutomatically: true, udid: fba94a73, uiautomator2ServerLaunchTimeout: 60000}, appium:deviceApiLevel: 33, appium:deviceManufacturer: Xiaomi, appium:deviceModel: M2101K6G, appium:deviceName: fba94a73, appium:deviceScreenDensity: 440, appium:deviceScreenSize: 1080x2400, appium:deviceUDID: fba94a73, appium:fullReset: false, appium:ignoreHiddenApiPolicyError: false, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 60, appium:noReset: false, appium:pixelRatio: 2.75, appium:platformVersion: 13, appium:startProxyAutomatically: true, appium:statBarHeight: 93, appium:takesScreenshot: true, appium:udid: fba94a73, appium:uiautomator2ServerLaunchTimeout: 60000, appium:viewportRect: {height: 2307, left: 0, top: 93, width: 1080}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 2a5eca16-70ee-4b2a-93ba-10dae6a8012f
org.openqa.selenium.WebDriverException: Proxy is not active for current session
Build info: version: '4.35.0', revision: '1c58e5028b'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '26.3', java.version: '17.0.9'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [2a5eca16-70ee-4b2a-93ba-10dae6a8012f, executeScript {args=[], script=interceptor: getInterceptedData}]
Capabilities {appium:app: /Users/u_m1asj/Downloads/al..., appium:appActivity: ru.alfabank.mobile.android...., appium:appPackage: ru.alfabank.mobile.android...., appium:autoGrantPermissions: false, appium:automationName: UiAutomator2, appium:clearDeviceLogsOnStart: true, appium:clearSystemFiles: true, appium:databaseEnabled: false, appium:desired: {app: /Users/u_m1asj/Downloads/al..., autoGrantPermissions: false, automationName: UiAutomator2, clearDeviceLogsOnStart: true, clearSystemFiles: true, fullReset: false, ignoreHiddenApiPolicyError: false, newCommandTimeout: 60, noReset: false, platformName: ANDROID, startProxyAutomatically: true, udid: fba94a73, uiautomator2ServerLaunchTimeout: 60000}, appium:deviceApiLevel: 33, appium:deviceManufacturer: Xiaomi, appium:deviceModel: M2101K6G, appium:deviceName: fba94a73, appium:deviceScreenDensity: 440, appium:deviceScreenSize: 1080x2400, appium:deviceUDID: fba94a73, appium:fullReset: false, appium:ignoreHiddenApiPolicyError: false, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 60, appium:noReset: false, appium:pixelRatio: 2.75, appium:platformVersion: 13, appium:startProxyAutomatically: true, appium:statBarHeight: 93, appium:takesScreenshot: true, appium:udid: fba94a73, appium:uiautomator2ServerLaunchTimeout: 60000, appium:viewportRect: {height: 2307, left: 0, top: 93, width: 1080}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 2a5eca16-70ee-4b2a-93ba-10dae6a8012f
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:167)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:138)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:50)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:215)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:243)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:557)Does this work for java?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels