selenium - Why using the driver.context(WEBVIEW) in appium, code is running in infinite loop. I am using appium with java language for android app -
i using android application automation through appium. , test on real device. through code can open required application. not able perform actions on it.
below image uiautomator view. red highlighted element, on need pass value.
as above element in webview, need change context switch webview.
file appdir = new file("d:\\repos\\apk"); file app = new file(appdir, "mnow-1.6.0.1-appstore.apk"); desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setcapability("device","android"); capabilities.setcapability("noreset", true); capabilities.setcapability("fullreset", false); //mandatory capabilities capabilities.setcapability("devicename","a9142d10"); //capabilities.setcapability("devicename","emulator"); //emulator-5554 capabilities.setcapability("platformname","android"); // capabilities.setcapability("udid", properties.uuid); capabilities.setcapability("unicodekeyboard", "true"); capabilities.setcapability("resetkeyboard", "true"); capabilities.setcapability("apppackage", "com.abcd.abcd"); capabilities.setcapability("appactivity", "com.abcd.app"); //other caps capabilities.setcapability("app", app.getabsolutepath()); driver = new androiddriver(new url("http://127.0.0.1:4723/wd/hub"), capabilities); //driver = new androiddriver(capabilities); system.out.print("hi"); thread.sleep(5000); touchaction touch = new touchaction(driver); set<string> contextnames = driver.getcontexthandles(); (string contextname : contextnames) { system.out.println(contextname); if (contextname.contains("webview")){ driver.context(contextname); } } driver.findelementbyxpath("//android.widget.button").click(); // driver.findelementbyxpath("//android.view.view[@index='0']/android.widget.edittext[@index='1']").sendkeys("mob@1234"); webelement tap = driver.findelementbyxpath("//android.widget.edittext[@index='1']"); tap.sendkeys("cholan");
this code going in infinite loop. below output. [testng] running: c:\users\ue.ideaic2016.3\system\temp-testng-customsuite.xml hinative_app webview_com.abcd.abcd
and code running infinitely,not breaking @ all. checked 10 mins, manually break code.
when debug it, found stopped @ driver.context() line of code.
any appreciated in advance.
Comments
Post a Comment