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.
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.
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.
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
Hi @Sandipan_Jana ,
You can check my comments and video on below link
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
}
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.
@awang Thanks for responding btw
@okiichinpo, yes, I believe that is what it means. The swipe will occur over a time interval of 1000 milliseconds.
For finding elements that are not on screen: I know that sometimes the element isn't returned by Instruments. I am guessing it's because the element hasn't been prepared in the device or simulator memory, so you have to swipe the screen until the element is close enough to the viewable area of the screen that the element gets instantiated.