This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
10 / 31
Dec 2014

StartActivity stop working in for java-client 2.1.0.
is it removed in 2.1.0 ?

20 days later

When I use the method for swipe with new implementation I am getting an error like below , I am not sure if I am doing anything fundamentally wrong.

Application : IMDB Android Native Application
Object : com.imdb.mobile:id/search

  • Code Snippet

    MobileElement element = (MobileElement)Driver.findElementById("com.imdb.mobile:id/search");
    			element.swipe(SwipeElementDirection.LEFT, 1000);

  • Error Message

    org.openqa.selenium.remote.RemoteWebElement cannot be cast to io.appium.java_client.MobileElement

Hi @JohnBinish!

What driver do you use? It looks like you use RemoteWebDriver or your own custom of AppiumDriver (which is abstract now) instead of AndroidDriver/IOSDriver.

I am using Appium Driver

AppiumDriver driver = new AppiumDriver(url, capabilities) {
public MobileElement scrollToExact(String arg0) {
// TODO Auto-generated method stub
return null;
}
public MobileElement scrollTo(String arg0) {
// TODO Auto-generated method stub
return null;
}
};

@SergeyTichomirov

When I Changed My Driver From Appium Driver to Android Driver The Code Snippet Is Working Fine. However I Objective Is To Create A Driver Which Can Be Used For Android and iOS , So If I Initiate Android Driver These Methods Won't Work For iOS Right ?

These methods should work fine for both Android and iOS. There some issues on the server-side (for example - problems with touch actions in WebView). These problems are going to be fixed in next releases.

Actually AppumDriver is abstract now and it is extended by AndroidDriver and IOSDriver because there are a lot of specific methods for each target platform. Some methods are implemented differently for Android and iOS. I think if there will be the supporting of WinMobile/FirefoxOS the number of methods like these will increase. So these classes were designed to avoid the possible problem of God Object.

As your tests you can parameterize them. There are a lot of stuff which describes how to do it.

You can declare AppiumDriver field and set here AndroidDriver/IOSDriver depending on given parameters

Thanks @SergeyTichomirov. I may have to create separate classes to handle different drivers. to give an backgroud about where I am facing issues: I am trying to create a tool agnostic keyword driven framework for mobile testing tools.For example Keywords like set to 'set' to set the text.These will work in Appium,Calabash and other tools also Web,Hybrid and Native for Android and iOS

:+1:

Is it all about statistics?

25 days later

On adding java client 2.1.0 to java build path, I am unable to get the below methods.
findElementByIosUIAutomation()
findElementsByIosUIAutomation()
findElementByAndroidUIAutomator()
findElementsByAndroidUIAutomator()

These methods are not implemented by AppiumDriver now. They are implemented by AndroidDriver and IOSDriver.

You can use

driver.findElement(MobileBy.IosUIAutomation("yourlocator"))

instead of them.

9 days later

Hi,
I am new to appium. Currently I am using scrollTo and scrollExact method for android emulator. Both are scrolling but it is scrolling till the end.But I wnt it to scroll to specific element.
Can anyone help me on that or whether that is a bug?
I am using java-client-2.1.0.jar

13 days later

Hi @Sandipan_Jana ,
You can check my comments and video on below link

16 days later

HI, I Tried to perform a swipe with this method. I don't have error message in Appium but it doesn't work.

I use this code to initialize the driver:

    import io.appium.java_client.AppiumDriver;
    import io.appium.java_client.ios.IOSDriver;
    import org.apache.commons.io.FileUtils;
    import org.openqa.selenium.OutputType;
    import org.openqa.selenium.WebDriver; 
    import org.openqa.selenium.remote.Augmenter; 
    import org.openqa.selenium.remote.DesiredCapabilities; 
    import java.io.File; 

public class Application {
            private final static String APPIUM_PORT = "4723";
             private final static String APPIUM_HOST = "127.0.0.1";
             public static AppiumDriver driver;     
		         capabilities.setCapability("platformName", "iOS"); 
            … 
            setDriver(new IOSDriver(new URL("http://" + appiumHost + ":" + appiumPort + "/wd/hub"), capabilities));
}

... and this code to perform the swipe:

public static void testSwipe(){
MobileElement element = (MobileElement) driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[2]"));
element.click(); // OK
element.swipe(SwipeElementDirection.LEFT, 1000); // Test Swipe #1 : KO
driver.swipe(300, 400, 10, 400, 500); // Test Swipe #2 : KO
}

11 days later

I am trying to use this new method with IOS automation and it is working but it is slow what is the second parameter 1000 do?

Hi @okiichinpo,

I'm guessing you're talking about the first post in this thread. I believe the 1000 refers to the duration of the command in milliseconds.

@awang So does that mean it will swipe for that long? What I am trying to do is find an element that is not on the screen.