|
7 | 7 | import java.util.List; |
8 | 8 | import org.apache.commons.io.FileUtils; |
9 | 9 |
|
10 | | -import org.openqa.selenium.By; |
11 | | -import org.openqa.selenium.WebElement; |
| 10 | +import io.appium.java_client.MobileBy; |
| 11 | +import io.appium.java_client.android.AndroidElement; |
| 12 | + |
12 | 13 | import org.openqa.selenium.OutputType; |
13 | 14 | import org.openqa.selenium.TakesScreenshot; |
14 | 15 | import org.openqa.selenium.support.ui.WebDriverWait; |
15 | 16 | import org.openqa.selenium.support.ui.ExpectedConditions; |
16 | 17 |
|
17 | | - |
18 | 18 | public class LocalTest extends BrowserStackJUnitTest { |
19 | 19 |
|
20 | 20 | @Test |
21 | 21 | public void test() throws Exception { |
22 | | - WebElement searchElement = new WebDriverWait(driver, 30).until( |
23 | | - ExpectedConditions.elementToBeClickable(By.id("com.example.android.basicnetworking:id/test_action"))); |
| 22 | + AndroidElement searchElement = (AndroidElement) new WebDriverWait(driver, 30).until( |
| 23 | + ExpectedConditions.elementToBeClickable(MobileBy.id("com.example.android.basicnetworking:id/test_action"))); |
24 | 24 | searchElement.click(); |
25 | | - WebElement insertTextElement = new WebDriverWait(driver, 30).until( |
26 | | - ExpectedConditions.elementToBeClickable(By.className("android.widget.TextView"))); |
| 25 | + AndroidElement insertTextElement = (AndroidElement) new WebDriverWait(driver, 30).until( |
| 26 | + ExpectedConditions.elementToBeClickable(MobileBy.className("android.widget.TextView"))); |
27 | 27 |
|
28 | | - WebElement testElement = null; |
29 | | - List<WebElement> allTextViewElements = driver.findElements(By.className("android.widget.TextView")); |
| 28 | + AndroidElement testElement = null; |
| 29 | + List<AndroidElement> allTextViewElements = driver.findElementsByClassName("android.widget.TextView"); |
30 | 30 | Thread.sleep(10); |
31 | | - for(WebElement textElement : allTextViewElements) { |
32 | | - System.out.println(textElement.getText()); |
| 31 | + for(AndroidElement textElement : allTextViewElements) { |
33 | 32 | if(textElement.getText().contains("The active connection is")) { |
34 | 33 | testElement = textElement; |
35 | 34 | } |
|
0 commit comments