Hi,
I am new to Appium automation. I am stuck right now with identifying the elements of login page. The app which I am testing is available in Google Play store “SmartView Quality”. When I am using command "System.out.println("name of context is “+ driver.getContextHandles());” , then I am getting output sometime as “name of context is [NATIVE_APP]”.
But sometime the same command give output as “name of context is [NATIVE_APP, WEBVIEW_chrome]”. So I am confused whether the app is native or hybrid.
Kindly help me with finding the elements of login page. I am using Appium Desktop 1.7.0 with Java client 6.1.0. I am testing it in real device “Samsung S7 Edge”
I tried to find the elements using Appium Inspector (Screenshot attached).
I am getting following locators:
id = Text1
class = android.widget.EditText
package = at.ondot.qmapp
But still unable to locate element using these locators
Here is my code:
public class SamsungOldQual
{
@Test
public void test_qual() throws InterruptedException {
AppiumDriver driver = null;
//AndroidDriver driver =null;
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(“deviceName”, “Phone”);
caps.setCapability(“udid”, “31603cdcf39*”);
caps.setCapability(“appPackage”, “at.ondot.qmapp”);
caps.setCapability(“appActivity”, “at.ondot.qmapp.MainActivity”);
caps.setCapability(“noReset”, “true”);
/*caps.setCapability(MobileCapabilityType.BROWSER_NAME, “Chrome”);
caps.setCapability(“autoWebview”, “true”);
caps.setCapability(“chromedriverExecutable”, “D:\Browser Drivers\chromedriver_win32_new\chromedriver.exe”);
*/
try {
driver = new AndroidDriver(new URL(“http://0.0.0.0:4723/wd/hub”), caps);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
System.out.println("Context count is "+driver.getContextHandles().size());
System.out.println("name of context is "+ driver.getContextHandles());
/*driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElementById(“at.ondot.qmapp:id/Password1”).sendKeys(“aaa”);
driver.context(“WEBVIEW_chrome”);*/
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.className(“android.widget.EditText”))).sendKeys(“abcd”);
//driver.findElement(By.id(“Text1”)).sendKeys(“yusuf”);
}
}
created
Sep '18
last reply
Oct '18
- 15
replies
- 899
views
- 2
users
- 3
links