Skip to content

Commit f966d1b

Browse files
Merge pull request #462 from TikhomirovSergey/#455
#455 fix
2 parents f730efa + 2a83d6d commit f966d1b

13 files changed

+446
-33
lines changed

src/main/java/io/appium/java_client/DefaultGenericMobileDriver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ public List findElementsByXPath(String using) {
142142
* @throws WebDriverException This method is not applicable with browser/webview UI.
143143
*/
144144
@Override public T findElementByAccessibilityId(String using) throws WebDriverException {
145-
return (T) findElement("accessibility id", using);
145+
return (T) findElement(MobileSelector.ACCESSIBILITY.toString(), using);
146146
}
147147

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

155155
/**

src/main/java/io/appium/java_client/DefaultGenericMobileElement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ public List findElementsByXPath(String using) {
132132
}
133133

134134
@Override public T findElementByAccessibilityId(String using) {
135-
return (T) findElement("accessibility id", using);
135+
return (T) findElement(MobileSelector.ACCESSIBILITY.toString(), using);
136136
}
137137

138138
@Override public List findElementsByAccessibilityId(String using) {
139-
return findElements("accessibility id", using);
139+
return findElements(MobileSelector.ACCESSIBILITY.toString(), using);
140140
}
141141

142142
/**
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* See the NOTICE file distributed with this work for additional
5+
* information regarding copyright ownership.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.appium.java_client;
18+
19+
import org.openqa.selenium.NoSuchElementException;
20+
import org.openqa.selenium.WebDriverException;
21+
import org.openqa.selenium.WebElement;
22+
23+
import java.util.List;
24+
25+
public interface FindsByFluentSelector<T extends WebElement> {
26+
27+
/**
28+
* Method performs the searching for a single element by some selector defined by string
29+
* and value of the given selector
30+
*
31+
* @param by is a string selector
32+
* @param using is a value of the given selector
33+
* @return the first found element
34+
*
35+
* @throws WebDriverException when current session doesn't support the given selector or when
36+
* value of the selector is not consistent.
37+
* @throws NoSuchElementException when no one element is found
38+
*/
39+
T findElement(String by, String using) throws WebDriverException, NoSuchElementException;
40+
41+
/**
42+
* Method performs the searching for a list of elements by some selector defined by string
43+
* and value of the given selector
44+
*
45+
* @param by is a string selector
46+
* @param using is a value of the given selector
47+
* @return a list of elements
48+
*
49+
* @throws WebDriverException when current session doesn't support the given selector or when
50+
* value of the selector is not consistent.
51+
*/
52+
List<T> findElements(String by, String using) throws WebDriverException;
53+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* See the NOTICE file distributed with this work for additional
5+
* information regarding copyright ownership.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.appium.java_client;
18+
19+
import org.openqa.selenium.WebElement;
20+
21+
import java.util.List;
22+
23+
public interface FindsByIosNSPredicate<T extends WebElement> {
24+
25+
T findElementByIosNsPredicate(String using);
26+
27+
List<T> findElementsByIosNsPredicate(String using);
28+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* See the NOTICE file distributed with this work for additional
5+
* information regarding copyright ownership.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
package io.appium.java_client;
19+
20+
import org.openqa.selenium.WebElement;
21+
22+
import java.util.List;
23+
24+
public interface FindsByWindowsAutomation<T extends WebElement> {
25+
26+
/**
27+
* Finds the first of elements that match the Windows UIAutomation selector supplied.
28+
*
29+
* @param selector a Windows UIAutomation selector
30+
* @return The first element that matches the given selector
31+
*/
32+
T findElementByWindowsUIAutomation(String selector);
33+
34+
/**
35+
* Finds a list of elements that match the Windows UIAutomation selector supplied.
36+
*
37+
* @param selector a Windows UIAutomation selector
38+
* @return a list of elements that match the given selector
39+
*/
40+
List<T> findElementsByWindowsUIAutomation(String selector);
41+
}

0 commit comments

Comments
 (0)