I am trying to automate Hybrid app as mentioned,
I tried using Java for android hybrid ( i am unable to locate element attributes)
Do i only need to work with Javascript, i donot find any documentation setup for JavaScript,
Is there any other setup process to work with Javascript to automate the app
Can some one support me…
Does the conflict occur if the app uses device specific browser as webview instance??
E.g: From Android if the app uses default browser for webkit?
Are you able to find elements of app in chrome adb plugin ? if yes it will work with JAVA. Is it possible to share app ?
Some javascript help is here
vrunoa
October 13, 2015, 2:00pm
4
@poornimapr32 to work with a Hybrid app, you may want to change Context first. And then start searching for the elements. I have some test working in this repo; https://github.com/Urucas/cordova-test/tree/master/example/tests .
Hope this helps.
@vrunoa
Do u have any sample app for “Cordova Phonegap built app” also?
vrunoa
October 15, 2015, 12:17pm
6
@amitjaincoer191 those examples are working with a Cordova app , check this line:
});
after(function() {
return browser
.quit();
});
it("should show hello world", async function(done) {
const contexts = await browser.contexts();
await browser.context(contexts[1]);
browser
.setImplicitWaitTimeout(10000)
.elementByClassName("hello")
.isDisplayed()
.then(function(isDisplayed){
isDisplayed.should.equal(true)
})
.nodeify(done);
});
it("should show h1", async function(done) {
There I change the context to the WEBVIEW and start searching for an element with a hello class.
Here the index.html of the Cordova Project.
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>
<div class="app">
<h1>Apache Cordova</h1>
<p class="hello">Hello World!<p>
<button id="btt" onclick="document.getElementsByClassName('hello')[0].innerText='Hello Appium!'">I'm here click me</button>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>