Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed findelement by nsPredicate string #394

Merged
merged 1 commit into from
May 24, 2016
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
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ Locators:
- findElementsByIosUIAutomation()
- findElementByAndroidUIAutomator()
- findElementsByAndroidUIAutomator()
- findElementByIosNsPredicate()
- findElementsByIosNsPredicate()

## Note to developers! ##
If you are working on this project and use Intellij Idea, you need to change the compiler to the Eclipse compilers instead of the default.
Expand All @@ -115,15 +113,13 @@ If you are using the Eclipse IDE, make sure you are using version Luna or later.
*4.0.0 (under construction yet)*
- all code marked `@Deprecated` was removed. Java client won't support old servers (v<1.5.0)
anymore.
- the searching for elements by nspredicate string was added. It requires the [XCUITest mode](https://github.com/appium/java-client/blob/master/docs/Installing-xcuitest-driver.md). Thanks to [@rafael-chavez](https://github.com/appium/java-client/pull/352) for the contribution
- the ability to start an activity using Android intent actions, intent categories, flags and arguments
was added to `AndroidDriver`. Thanks to [@saikrishna321](https://github.com/saikrishna321) for the contribution.
- `scrollTo()` and `scrollToExact()` became deprecated. They are going to be removed in the next release.
- the `io.appium.java_client.NetworkConnectionSetting` class was marked deprecated
- the enum `io.appium.java_client.android.Connection` was added. All supported network bitmasks are defined there.
- Android. Old methods which get/set connection were marked `@Deprecated`
- Android. New methods which consume/return `io.appium.java_client.android.Connection` were added.
- the `nsPredicate` parameter was added to the `iOSFindBy` annotation
- the `commandRepository` field is public now. The modification of the `MobileCommand`
- The refactoring of `io.appium.java_client.internal.JsonToMobileElementConverter`. Now it accepts
`org.openqa.selenium.remote.RemoteWebDriver` as the constructor parameter. It is possible to re-use
Expand Down
19 changes: 0 additions & 19 deletions docs/Installing-xcuitest-driver.md

This file was deleted.

11 changes: 0 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,6 @@
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
<packaging>jar</packaging>
<name>java-client</name>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/appium/java_client/AppiumDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ private static CommandInfo deleteC(String url) {
return super.findElements(by);
}

@Override public List<T> findElements(String by, String using) {
return super.findElements(by, using);
}

@Override public List<T> findElementsById(String id) {
return super.findElementsById(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,18 @@ public DefaultGenericMobileDriver(CommandExecutor executor, Capabilities desired
return super.findElements(by);
}

@Override public List findElements(String by, String using) {
return super.findElements(by, using);
}

@Override public T findElement(By by) {
return (T) super.findElement(by);
}

@Override public T findElement(String by, String using) {
return (T) super.findElement(by, using);
}

@Override public List findElementsById(String id) {
return super.findElementsById(id);
}
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/io/appium/java_client/FindsByIosNsPredicate.java

This file was deleted.

31 changes: 0 additions & 31 deletions src/main/java/io/appium/java_client/MobileBy.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ public static By AndroidUIAutomator(final String uiautomatorText) {
public static By AccessibilityId(final String accessibilityId) {
return new ByAccessibilityId(accessibilityId);
}

/**
* This locator strategy is available in XCUITest Driver mode
* @param iOSNsPredicateString is an an iOS NsPredicate String
* @return an instance of {@link io.appium.java_client.MobileBy.ByIosNsPredicate}
*/
public static By IosNsPredicateString(final String iOSNsPredicateString) {
return new ByIosNsPredicate(iOSNsPredicateString);
}

public static class ByIosUIAutomation extends MobileBy implements Serializable {

Expand All @@ -106,28 +97,6 @@ public List<WebElement> findElements(SearchContext context) {
}
}

public static class ByIosNsPredicate extends MobileBy implements Serializable {

public ByIosNsPredicate(String iOSNsPredicate) {
super(iOSNsPredicate);
}

@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
return (List<WebElement>) ((FindsByIosNsPredicate<?>) context)
.findElementsByIosNsPredicate(getLocatorString());
}

@Override public WebElement findElement(SearchContext context) {
return ((FindsByIosNsPredicate<?>) context)
.findElementByIosNsPredicate(getLocatorString());
}

@Override public String toString() {
return "By.IosNsPredicate: " + getLocatorString();
}
}


public static class ByAndroidUIAutomator extends MobileBy implements Serializable {

Expand Down
25 changes: 1 addition & 24 deletions src/main/java/io/appium/java_client/ios/IOSDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.FindsByAccessibilityId;
import io.appium.java_client.FindsByIosNsPredicate;
import io.appium.java_client.FindsByIosUIAutomation;
import io.appium.java_client.ScrollsTo;
import io.appium.java_client.SwipeElementDirection;
Expand Down Expand Up @@ -56,7 +55,7 @@
public class IOSDriver<T extends WebElement>
extends AppiumDriver<T>
implements IOSDeviceActionShortcuts, GetsNamedTextField<T>,
FindsByIosUIAutomation<T>, FindsByIosNsPredicate<T> {
FindsByIosUIAutomation<T> {

private static final String IOS_PLATFORM = MobilePlatform.IOS;

Expand Down Expand Up @@ -267,28 +266,6 @@ public List<T> findElementsByIosUIAutomation(String using)
throws WebDriverException {
return (List<T>) findElements("-ios uiautomation", using);
}

/**
* @throws org.openqa.selenium.WebDriverException
* This method is not applicable with browser/webview UI.
*/
@SuppressWarnings("unchecked")
@Override
public T findElementByIosNsPredicate(String using)
throws WebDriverException {
return (T) findElement("-ios predicate string", using);
}

/**
* @throws org.openqa.selenium.WebDriverException
* This method is not applicable with browser/webview UI.
*/
@SuppressWarnings("unchecked")
@Override
public List<T> findElementsByIosNsPredicate(String using)
throws WebDriverException {
return (List<T>) findElements("-ios predicate string", using);
}

/**
* Lock the device (bring it to the lock screen) for a given number of
Expand Down
26 changes: 1 addition & 25 deletions src/main/java/io/appium/java_client/ios/IOSElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.google.common.collect.ImmutableMap;

import io.appium.java_client.FindsByIosNsPredicate;
import io.appium.java_client.FindsByIosUIAutomation;
import io.appium.java_client.MobileCommand;
import io.appium.java_client.MobileElement;
Expand All @@ -31,8 +30,7 @@
import java.util.List;

public class IOSElement extends MobileElement
implements FindsByIosUIAutomation<MobileElement>, ScrollsTo<MobileElement>,
FindsByIosNsPredicate<MobileElement> {
implements FindsByIosUIAutomation<MobileElement>, ScrollsTo<MobileElement> {
/**
* @throws WebDriverException
* This method is not applicable with browser/webview UI.
Expand All @@ -55,28 +53,6 @@ public class IOSElement extends MobileElement
}
return result;
}

/**
* @throws org.openqa.selenium.WebDriverException
* This method is not applicable with browser/webview UI.
*/
@Override public MobileElement findElementByIosNsPredicate(String using)
throws WebDriverException {
return (IOSElement) findElement("-ios predicate string", using);
}

/**
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
@Override public List<MobileElement> findElementsByIosNsPredicate(String using)
throws WebDriverException {
List<MobileElement> result = new ArrayList<MobileElement>();
List<WebElement> found = findElements("-ios predicate string", using);
for (WebElement e : found) {
result.add((IOSElement) e);
}
return result;
}

/**
* This method is deprecated because it is not consistent and it is going to be removed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,7 @@ enum Strategies {
return By
.partialLinkText(getValue(annotation, this));
}
},
BYNSPREDICATE("nsPredicate") {
@Override By getBy(Annotation annotation) {
return MobileBy
.IosNsPredicateString(getValue(annotation, this));
}
}
;
};

private final String valueName;

Expand Down
11 changes: 0 additions & 11 deletions src/main/java/io/appium/java_client/pagefactory/iOSFindBy.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,4 @@
* It is a xpath to the target element.
*/
String xpath() default "";

/**
* This parameter makes perform the searching by iOS NSPredicate.
* This locator strategy is available in XCUITest Driver mode.
* Documentation to read:
* https://github.com/appium/java-client/blob/master/docs/
* Installing-xcuitest-driver.md
*
* https://github.com/appium/appium-xcuitest-driver/blob/master/README.md
*/
String nsPredicate() default "";
}
112 changes: 0 additions & 112 deletions src/test/java/io/appium/java_client/ios/XCUIDriverTest.java

This file was deleted.