Skip to content

Commit

Permalink
Merge pull request #462 from TikhomirovSergey/#455
Browse files Browse the repository at this point in the history
#455 fix
  • Loading branch information
TikhomirovSergey authored Aug 28, 2016
2 parents f730efa + 2a83d6d commit f966d1b
Show file tree
Hide file tree
Showing 13 changed files with 446 additions and 33 deletions.
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);
}
41 changes: 41 additions & 0 deletions src/main/java/io/appium/java_client/FindsByWindowsAutomation.java
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

0 comments on commit f966d1b

Please sign in to comment.