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

#455 fix #462

Merged
merged 4 commits into from
Aug 28, 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
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ public List findElementsByXPath(String using) {
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
@Override public T findElementByAccessibilityId(String using) throws WebDriverException {
return (T) findElement("accessibility id", using);
return (T) findElement(MobileSelector.ACCESSIBILITY.toString(), using);
}

/**
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
@Override public List findElementsByAccessibilityId(String using) throws WebDriverException {
return (List<T>) findElements("accessibility id", using);
return (List<T>) findElements(MobileSelector.ACCESSIBILITY.toString(), using);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ public List findElementsByXPath(String using) {
}

@Override public T findElementByAccessibilityId(String using) {
return (T) findElement("accessibility id", using);
return (T) findElement(MobileSelector.ACCESSIBILITY.toString(), using);
}

@Override public List findElementsByAccessibilityId(String using) {
return findElements("accessibility id", using);
return findElements(MobileSelector.ACCESSIBILITY.toString(), using);
}

/**
Expand Down
53 changes: 53 additions & 0 deletions src/main/java/io/appium/java_client/FindsByFluentSelector.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.appium.java_client;

import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;

import java.util.List;

public interface FindsByFluentSelector<T extends WebElement> {

/**
* Method performs the searching for a single element by some selector defined by string
* and value of the given selector
*
* @param by is a string selector
* @param using is a value of the given selector
* @return the first found element
*
* @throws WebDriverException when current session doesn't support the given selector or when
* value of the selector is not consistent.
* @throws NoSuchElementException when no one element is found
*/
T findElement(String by, String using) throws WebDriverException, NoSuchElementException;

/**
* Method performs the searching for a list of elements by some selector defined by string
* and value of the given selector
*
* @param by is a string selector
* @param using is a value of the given selector
* @return a list of elements
*
* @throws WebDriverException when current session doesn't support the given selector or when
* value of the selector is not consistent.
*/
List<T> findElements(String by, String using) throws WebDriverException;
}
28 changes: 28 additions & 0 deletions src/main/java/io/appium/java_client/FindsByIosNSPredicate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.appium.java_client;

import org.openqa.selenium.WebElement;

import java.util.List;

public interface FindsByIosNSPredicate<T extends WebElement> {

T findElementByIosNsPredicate(String using);

List<T> findElementsByIosNsPredicate(String using);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


package io.appium.java_client;

import org.openqa.selenium.WebElement;

import java.util.List;

public interface FindsByWindowsAutomation<T extends WebElement> {

/**
* Finds the first of elements that match the Windows UIAutomation selector supplied.
*
* @param selector a Windows UIAutomation selector
* @return The first element that matches the given selector
*/
T findElementByWindowsUIAutomation(String selector);

/**
* Finds a list of elements that match the Windows UIAutomation selector supplied.
*
* @param selector a Windows UIAutomation selector
* @return a list of elements that match the given selector
*/
List<T> findElementsByWindowsUIAutomation(String selector);
}
Loading