Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
818 changes: 409 additions & 409 deletions src/main/java/io/appium/java_client/AppiumDriver.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Response execute(String driverCommand, Map<String, ?> parameters) {
return super.execute(driverCommand, parameters);
}

@Override
@Override
public List findElements(By by){
return super.findElements(by);
}
Expand All @@ -52,7 +52,7 @@ public T findElement(By by){
return (T) super.findElement(by);
}

@Override
@Override
public List findElementsById(String id){
return super.findElementsById(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Response execute(String driverCommand, Map<String, ?> parameters) {
return super.execute(driverCommand, parameters);
}

@Override
@Override
public List findElements(By by){
return super.findElements(by);
}
Expand All @@ -54,7 +54,7 @@ public T findElement(By by){
return (T) super.findElement(by);
}

@Override
@Override
public List findElementsById(String id){
return super.findElementsById(id);
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/io/appium/java_client/DeviceActionShortcuts.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

public interface DeviceActionShortcuts {

/**
* Hides the keyboard if it is showing.
* On iOS, there are multiple strategies for hiding the keyboard. Defaults to the "tapOutside" strategy (taps outside the keyboard).
* Switch to using hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done") if this doesn't work.
*/
public void hideKeyboard();
/**
* Hides the keyboard if it is showing.
* On iOS, there are multiple strategies for hiding the keyboard. Defaults to the "tapOutside" strategy (taps outside the keyboard).
* Switch to using hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done") if this doesn't work.
*/
void hideKeyboard();

}
28 changes: 14 additions & 14 deletions src/main/java/io/appium/java_client/HasAppStrings.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@


public interface HasAppStrings {

/**
* Get all defined Strings from an app for the default language
*
* @return a string of all the localized strings defined in the app
*/
public String getAppStrings();

/**
* Get all defined Strings from an app for the specified language
*
* @param language strings language code
* @return a string of all the localized strings defined in the app
*/
public String getAppStrings(String language);
/**
* Get all defined Strings from an app for the default language
*
* @return a string of all the localized strings defined in the app
*/
String getAppStrings();

/**
* Get all defined Strings from an app for the specified language
*
* @param language strings language code
* @return a string of all the localized strings defined in the app
*/
String getAppStrings(String language);

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import org.openqa.selenium.WebDriverException;

public class IllegalCoordinatesException extends WebDriverException {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;

public IllegalCoordinatesException(String message) {
super(message);
}
public IllegalCoordinatesException(String message) {
super(message);
}

}
86 changes: 43 additions & 43 deletions src/main/java/io/appium/java_client/InteractsWithApps.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,54 +17,54 @@
package io.appium.java_client;

public interface InteractsWithApps {
/**
* Launch the app which was provided in the capabilities at session creation
*/
public void launchApp();
/**
* Launch the app which was provided in the capabilities at session creation
*/
void launchApp();

/**
* Install an app on the mobile device
*
* @param appPath
* path to app to install
*/
public void installApp(String appPath);
/**
* Install an app on the mobile device
*
* @param appPath
* path to app to install
*/
void installApp(String appPath);

/**
* Checks if an app is installed on the device
*
* @param bundleId
* bundleId of the app
* @return True if app is installed, false otherwise
*/
public boolean isAppInstalled(String bundleId);
/**
* Checks if an app is installed on the device
*
* @param bundleId
* bundleId of the app
* @return True if app is installed, false otherwise
*/
boolean isAppInstalled(String bundleId);

/**
* Reset the currently running app for this session
*/
public void resetApp();
/**
* Reset the currently running app for this session
*/
void resetApp();

/**
* Runs the current app as a background app for the number of seconds
* requested. This is a synchronous method, it returns after the back has
* been returned to the foreground.
*
* @param seconds
* Number of seconds to run App in background
*/
public void runAppInBackground(int seconds);
/**
* Runs the current app as a background app for the number of seconds
* requested. This is a synchronous method, it returns after the back has
* been returned to the foreground.
*
* @param seconds
* Number of seconds to run App in background
*/
void runAppInBackground(int seconds);

/**
* Remove the specified app from the device (uninstall)
*
* @param bundleId
* the bunble identifier (or app id) of the app to remove
*/
public void removeApp(String bundleId);
/**
* Remove the specified app from the device (uninstall)
*
* @param bundleId
* the bunble identifier (or app id) of the app to remove
*/
void removeApp(String bundleId);

/**
* Close the app which was provided in the capabilities at session creation
*/
public void closeApp();
/**
* Close the app which was provided in the capabilities at session creation
*/
void closeApp();

}
46 changes: 23 additions & 23 deletions src/main/java/io/appium/java_client/InteractsWithFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@

public interface InteractsWithFiles {

/**
*
* @param remotePath
* On Android and iOS, this is either the path to the file
* (relative to the root of the app's file system). On iOS only,
* if path starts with /AppName.app, which will be replaced with
* the application's .app directory
* @return A byte array of Base64 encoded data.
*/
public byte[] pullFile(String remotePath);
/**
*
* @param remotePath
* On Android and iOS, this is either the path to the file
* (relative to the root of the app's file system). On iOS only,
* if path starts with /AppName.app, which will be replaced with
* the application's .app directory
* @return A byte array of Base64 encoded data.
*/
byte[] pullFile(String remotePath);

/**
* Pull a folder from the simulator/device. Does not work on iOS Real
* Devices, but works on simulators
*
* @param remotePath
* On Android and iOS, this is either the path to the file
* (relative to the root of the app's file system). On iOS only,
* if path starts with /AppName.app, which will be replaced with
* the application's .app directory
* @return A byte array of Base64 encoded data, representing a ZIP ARCHIVE
* of the contents of the requested folder.
*/
public byte[] pullFolder(String remotePath);
/**
* Pull a folder from the simulator/device. Does not work on iOS Real
* Devices, but works on simulators
*
* @param remotePath
* On Android and iOS, this is either the path to the file
* (relative to the root of the app's file system). On iOS only,
* if path starts with /AppName.app, which will be replaced with
* the application's .app directory
* @return A byte array of Base64 encoded data, representing a ZIP ARCHIVE
* of the contents of the requested folder.
*/
byte[] pullFolder(String remotePath);

}
4 changes: 2 additions & 2 deletions src/main/java/io/appium/java_client/MobileDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import java.util.Map;

public interface MobileDriver extends WebDriver,
PerformsTouchActions,
PerformsTouchActions,
ContextAware, Rotatable, FindsByAccessibilityId<WebElement>, LocationContext,
DeviceActionShortcuts, TouchShortcuts, InteractsWithFiles,
InteractsWithApps, ScrollsTo<WebElement>, HasAppStrings {
public Response execute(String driverCommand, Map<String, ?> parameters);
Response execute(String driverCommand, Map<String, ?> parameters);
}
84 changes: 42 additions & 42 deletions src/main/java/io/appium/java_client/MobileElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,41 @@
@SuppressWarnings({ "unchecked"})
public abstract class MobileElement extends DefaultGenericMobileElement<MobileElement> {

protected FileDetector fileDetector;

public Point getCenter() {
Point upperLeft = this.getLocation();
Dimension dimensions = this.getSize();
return new Point(upperLeft.getX() + dimensions.getWidth() / 2, upperLeft.getY() + dimensions.getHeight() / 2);
}

@Override
public void pinch() {
((AppiumDriver<?>) parent).pinch(this);
}

@Override
public void tap(int fingers, int duration) {
((AppiumDriver<?>) parent).tap(fingers, this, duration);
}

@Override
public void zoom() {
((AppiumDriver<?>) parent).zoom(this);
}

@Override
public void swipe(SwipeElementDirection direction, int duration) {
direction.swipe((AppiumDriver<?>) parent, this, 0, 0, duration);
}

@Override
public void swipe(SwipeElementDirection direction, int offsetFromStartBorder,
int offsetFromEndBorder, int duration) throws IllegalCoordinatesException {
direction.swipe((AppiumDriver<?>) parent, this, offsetFromStartBorder,
offsetFromEndBorder, duration);
}
protected FileDetector fileDetector;

public Point getCenter() {
Point upperLeft = this.getLocation();
Dimension dimensions = this.getSize();
return new Point(upperLeft.getX() + dimensions.getWidth() / 2, upperLeft.getY() + dimensions.getHeight() / 2);
}

@Override
public void pinch() {
((AppiumDriver<?>) parent).pinch(this);
}

@Override
public void tap(int fingers, int duration) {
((AppiumDriver<?>) parent).tap(fingers, this, duration);
}

@Override
public void zoom() {
((AppiumDriver<?>) parent).zoom(this);
}


@Override
public void swipe(SwipeElementDirection direction, int duration) {
direction.swipe((AppiumDriver<?>) parent, this, 0, 0, duration);
}

@Override
public void swipe(SwipeElementDirection direction, int offsetFromStartBorder,
int offsetFromEndBorder, int duration) throws IllegalCoordinatesException {
direction.swipe((AppiumDriver<?>) parent, this, offsetFromStartBorder,
offsetFromEndBorder, duration);
}

@Override
public List<MobileElement> findElements(By by){
Expand All @@ -74,7 +74,7 @@ public List<MobileElement> findElementsById(String id){
return super.findElementsById(id);
}

public List<MobileElement> findElementsByLinkText(String using) {
public List<MobileElement> findElementsByLinkText(String using) {
return super.findElementsByLinkText(using);
}

Expand All @@ -98,16 +98,16 @@ public List<MobileElement> findElementsByCssSelector(String using) {
return super.findElementsByCssSelector(using);
}

public List<MobileElement> findElementsByXPath(String using) {
public List<MobileElement> findElementsByXPath(String using) {
return super.findElementsByXPath(using);
}

@Override
public List<MobileElement> findElementsByAccessibilityId(String using) {
List<MobileElement> result = new ArrayList<MobileElement>();
List<WebElement> found = findElements("accessibility id", using);
for (WebElement e: found)
result.add((MobileElement) e);
return result;
List<MobileElement> result = new ArrayList<MobileElement>();
List<WebElement> found = findElements("accessibility id", using);
for (WebElement e: found)
result.add((MobileElement) e);
return result;
}
}
Loading