java-client icon indicating copy to clipboard operation
java-client copied to clipboard

is getPerformanceData() working?

Open game8149 opened this issue 4 years ago • 3 comments

Description

Hi, actually i can´t find getPerformanceData method from driver. I'm triying all classes and interfaces to instantiate and get that method, there isn't.

Did you remove that method?

GetPerformanceData

Environment

  • Java client build version or git revision if you use some snapshot: 7.5
  • Appium server version or git revision if you use some snapshot: 1.20.2
  • Desktop OS/version used to run Appium if necessary: Android
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: Appium.exe
  • Mobile platform/version under test: Android 7.0
  • Real device or emulator/simulator: Real Device

Code To Reproduce Issue [ Good To Have ]

My Pom.xml:

` <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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.realplazatestandroid</groupId> <artifactId>realplazatestandroid</artifactId> 0.0.1-SNAPSHOT <groupId>com.github.appium</groupId> <artifactId>java-client</artifactId> f726f3b <groupId>junit</groupId> <artifactId>junit</artifactId> 4.12

</dependencies>


<!-- Added for AppCenter/Test runs -->
<repositories>
	<repository>
		<id>jcenter</id>
		<url>https://jcenter.bintray.com/</url>
	</repository> 
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository> 
</repositories>
<profiles>
	<profile>
		<id>repl</id>
		<dependencies>
			<dependency>
				<groupId>com.javarepl</groupId>
				<artifactId>javarepl</artifactId>
				<version>428</version>
			</dependency>
		</dependencies>
		<build>
			<plugins>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>exec-maven-plugin</artifactId>
					<configuration>
						<executable>java</executable>
						<classpathScope>test</classpathScope>
						<arguments>
							<argument>-Djansi.passthrough=true</argument>
							<argument>-classpath</argument>
							<classpath />
							<argument>javarepl.Main</argument>
						</arguments>
					</configuration>
					<executions>
						<execution>
							<id>runRepl</id>
							<phase>process-test-classes</phase>
							<goals>
								<goal>exec</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</build>
	</profile> 
</profiles>
`

My Java test class:

` package realplazatestandroid;

import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait;

import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidTouchAction; import io.appium.java_client.remote.MobileCapabilityType;

import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit;

import org.junit.rules.TestWatcher; import org.junit.runners.MethodSorters; import org.junit.Rule;

@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class androidTest {

private static  AndroidDriver<MobileElement> driver = null;
private static MobileElement CalculatorResult = null;

@BeforeClass
public static void startApp() throws MalformedURLException {
	DesiredCapabilities capabilities = new DesiredCapabilities(); 
	capabilities.setCapability("appPackage", "com.realplazago.app");
	capabilities.setCapability("appActivity", ".MainActivity");
	capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "android");
	capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.0");
	capabilities.setCapability("autoGrantPermissions", true);
	capabilities.setCapability(MobileCapabilityType.UDID, "MWS0216C02001198");
	capabilities.setCapability("browserstack.networkLogs", "true");
	capabilities.setCapability(MobileCapabilityType.APP,
			"D:\\app-release.apk");
	capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 7913);
	capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");

	URL url = new URL("http://localhost:4723/wd/hub"); 
    driver = new  AndroidDriver<MobileElement>(url, capabilities);   
    driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); 
}

@Test
public void stage1_canStartAppInTest() throws MalformedURLException, InterruptedException {
	CaptureScreenshot("Launch");
	driver.launchApp(); 
	CaptureScreenshot("Starting");
}

@Test
public void stage2_canGestureAppInTest() throws Exception, InterruptedException { 
	driver.launchApp();
	if (driver != null) {
		AndroidTouchAction action = null;

		CaptureScreenshot("Starting"); 
		WebDriverWait wait = new WebDriverWait(driver, 30);
		wait.until(ExpectedConditions.elementToBeClickable(By.xpath(
				"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.widget.ImageView[1]")));
		MobileElement el1 = (MobileElement) driver.findElementByXPath(
				"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.widget.ImageView[1]");
		el1.click(); 
	} else {
		throw new Exception("App launched dependency");
	}

}

private void CaptureScreenshot(String name) {
	File file = driver.getScreenshotAs(OutputType.FILE);
	try {
		FileUtils.copyFile(file, new File(name + ".png"));
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} 
}

@After
public void after() throws Exception {
	if (driver != null) {
		driver.quit();
	}
}

} `

game8149 avatar Mar 16 '21 13:03 game8149

https://github.com/appium/java-client/search?q=getPerformanceData Seems there?

KazuCocoa avatar Mar 16 '21 17:03 KazuCocoa

I am facing the same issue, it says Cannot resolve getPerformanceData()

gaganchawla avatar Aug 16 '21 01:08 gaganchawla

Hello,

Same issue here. Can't resolve it either.

TSavin avatar Jan 28 '22 08:01 TSavin