-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFindElements
More file actions
41 lines (28 loc) · 1.74 KB
/
Copy pathFindElements
File metadata and controls
41 lines (28 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import com.testsigma.customfunc.common.CustomTestStep;
import com.testsigma.customfunc.common.TestsigmaCustomFunctions;
import com.testsigma.customfunc.result.ResultConstants;
import com.testsigma.customfunc.result.TestStepResult;
import com.testsigma.testengine.exceptions.TestEngineException;
public class elementList extends TestsigmaCustomFunctions {
TestStepResult result=new TestStepResult();
@CustomTestStep
public TestStepResult makegeolocation() throws TestEngineException, InterruptedException{
try {
@SuppressWarnings("unchecked")
List<WebElement> wb=driver.findElements(By.xpath("//android.widget.FrameLayout[@resource-id=\"android:id/content\"]/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[4]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.view.ViewGroup/android.widget.TextView[1]"));
for (WebElement webElement : wb) {
String name1 = webElement.getText();
result.setStatus(ResultConstants.SUCCESS);
result.setMessage(name1);
}
}catch(Exception e){
result.setStatus(ResultConstants.FAILURE);
e.printStackTrace();
result.setMessage(e.getMessage());
}
return result;
}
}