Hello All,
I started with Appium a few days ago, and I'm struggling a bit - if you could help, I'd appreciate. I am trying to emulate user actions in chrome browser on a real android (4.4.2) device - and continuously failed.
All I ever get from the server is "info: [debug] Responding to client that a method is not implemented"
Did anyone ever succeeded in simply launching chrome browser (works fine), load a webpage (works fine), and scroll it slowly (just cannot find out how to do that)?
I tried through the AndroidDriver methods and through the TouchAction methods, no success.
Can anyone just provide a very simple example that should work fine?
Thank you so much.
My setup:
- Appium server: 1.3.7.2
- Chromedriver: 2.15.322448 (replaced older one in Appium server directory)
- Appium java client: 2.2.0
- Chrome on Android device: 42.0.2311.111
- Selenium java lib: 2.45.0
My basic code:
package test;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class TestBrowser2 {
AppiumDriver driver;
TouchAction useractions;
public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
capabilities.setCapability(CapabilityType.VERSION, "4.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "4d00cc5e4af5315b");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity", ".Main");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
useractions = new TouchAction (driver);
}
public void browse() throws Exception {
driver.navigate().to("http://www.cnn.com");
useractions.tap(200, 500);
//useractions.press(200, 500);
//useractions.moveTo(200, 200);
//useractions.release();
useractions.perform();
//driver.zoom(250, 500);
//driver.rotate(ScreenOrientation.LANDSCAPE);
//driver.swipe(100, 100, 100, 50, 5);
}
public void teardown(){
driver.quit();
}
public static void main(String[] args) throws Exception {
TestBrowser2 test = new TestBrowser2();
test.setUp();
try {
test.browse();
} finally {
test.teardown();
}
}
}