<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Omesh Dhanushka on Medium]]></title>
        <description><![CDATA[Stories by Omesh Dhanushka on Medium]]></description>
        <link>https://medium.com/@dhanushka121?source=rss-7b092e62aa81------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3ChXjI2fy1rWakBS.</url>
            <title>Stories by Omesh Dhanushka on Medium</title>
            <link>https://medium.com/@dhanushka121?source=rss-7b092e62aa81------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:27:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dhanushka121/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Resolving Practical Issues Associated with Test Automation in Android using Appium]]></title>
            <link>https://medium.com/aeturnuminc/resolving-practical-issues-associated-with-test-automation-in-android-using-appium-bdf5b912c489?source=rss-7b092e62aa81------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdf5b912c489</guid>
            <category><![CDATA[mobile-automation-testing]]></category>
            <category><![CDATA[id]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[xpath]]></category>
            <category><![CDATA[appium]]></category>
            <dc:creator><![CDATA[Omesh Dhanushka]]></dc:creator>
            <pubDate>Tue, 09 Jul 2019 12:09:38 GMT</pubDate>
            <atom:updated>2019-07-09T12:17:18.743Z</atom:updated>
            <content:encoded><![CDATA[<p>When I’m automating android mobile applications using appium java client to capture elements using XPath, id strategy etc, I faced some problems when executing automation scripts. This blog post is about to answer all those problems.</p><h3><strong>What is Appium?</strong></h3><p>Appium is an open source mobile test automation tool for Android and IOS platforms. Appium uses <strong>JSON wire protocol</strong> internally to communicate with Android and IOS mobile applications with the help of Selenium web driver.</p><h3>Problems &amp; Solutions when automating native apps</h3><h3><strong><em>Native app automation</em></strong></h3><h4><strong><em>1. XPath strategy conflict for same element between different android API versions.</em></strong></h4><p><strong><em>Problem</em></strong></p><p>In different android API levels, the XPath will be different. <br>For ex: <br>same application test XPath for element: android.widget.EditText (username).<br>Jelly Bean = 18 API version<br>Oreo = 27 API version</p><p>XPath for Jelly Bean :</p><pre>/hierarchy/android.widget.FrameLayout/android.view.View/ android.widget.FrameLayout/android.view.View/android.widget.EditText[1]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sko3m6UiQZ3_7QvWEkxzjQ.jpeg" /><figcaption>Nexus S API 18 version of the app</figcaption></figure><p>XPath for Oreo :</p><pre>/hierarchy/android.widget.FrameLayout/android.view.ViewGroup/ android.widget.FrameLayout[2]/android.view.ViewGroup/android.widget.EditText[1]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-hnJCjf1Co5b4nKsZJvaw.jpeg" /><figcaption>Nexus API 27 version of the app</figcaption></figure><p>So in here if we use Jelly Bean version Xpath for test the same element in the Oreo version, it will fail the test execution. So using Xpath to find the elements is to be the last option when you used to execute the same test script for multiple Android API versions. <br> <strong>Link to refer:</strong> <a href="https://discuss.appium.io/t/how-to-get-element-by-xpath/12711/2">https://discuss.appium.io/t/how-to-get-element-by-xpath/12711/2</a></p><p><strong>Solution</strong></p><p>Always try to use <strong>id, class and text presents in the element</strong>. Because those things will not change with the API version of the Android.</p><h4><em>2</em>.<strong> <em>Cannot identify elements using id strategy.</em></strong></h4><p><strong><em>Problem</em></strong></p><p>We cannot identify elements by id in Android API version 17 and lower versions. Here is the <strong>GitHub link</strong> for further reference.<br><strong> Link to refer :</strong> <a href="https://github.com/appium/appium/issues/2340">https://github.com/appium/appium/issues/2340</a></p><p><strong>Solution</strong></p><p>So in order to identify elements using id, it requires API version 18 or newer version.</p><h4><strong><em>3</em>.</strong> <strong><em>Native android keyboard not minimize always.</em></strong></h4><p><strong>Problem</strong></p><p>In some cases when we test the same login application in different resolutions of android devices, after the user enters text field value, then the <strong>keyboard is</strong> <strong>not hidden by default</strong>. Then if we try to click, the login button test may fail by saying unable to find element if the keyboard is hiding the button (button is shadowed by keyboard).</p><p><strong>Solution</strong></p><p>Always hide the default keyboard after each type completion, before click the next element.</p><h4><strong><em>4. Bypass Splash screens.</em></strong></h4><p><strong>Problem</strong></p><p>The most common problem is how to bypass the splash screen in native android apps.</p><p><strong>Solution</strong></p><p>Here is how it is done. You have two options.</p><p>a) Use <strong>explicit wait</strong> in this scenario. <br>Here is a code sample</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/507bfc35b846990850cc15b541dc0509/href">https://medium.com/media/507bfc35b846990850cc15b541dc0509/href</a></iframe><p>b) Use <strong>appWaitActivity</strong> and <strong>appWaitDuration</strong> <strong>desired capability</strong> and set the App activity waiting time. Here is a code sample.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51ef3a15a60d8ba72fe930d835fb6432/href">https://medium.com/media/51ef3a15a60d8ba72fe930d835fb6432/href</a></iframe><h3><strong><em>Hybrid app automation</em></strong></h3><h4><strong><em>1. Cannot get web view context if the app is not chrome debug enabled.</em></strong></h4><p><strong>Problem</strong></p><p>Cannot get web view context if the app is not chrome debug enabled. If an application developed as a Hybrid app, if the developer set</p><pre><em>WebView.setWebContentsDebuggingEnabled(false);</em></pre><p>we only get the <strong>NATIVE_VIEW</strong> context. Therefore, we cannot get the <strong>WEB_VIEW</strong> context for automate hybrid application using web elements.</p><p><strong>Solution</strong></p><p>Developer needs to enable the chrome debug property.</p><pre><em>WebView.setWebContentsDebuggingEnabled(true);</em></pre><p>Let’s see how the hybrid application contexts looks like when WebView.setWebContentsDebuggingEnabled(true / false) with Appium logs.</p><p>App with setWebContentsDebuggingEnabled(false)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d138bc876defca25a88438185405bcf/href">https://medium.com/media/1d138bc876defca25a88438185405bcf/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*JWqrD5aD1DRaiX6Cz5m7HQ.png" /><figcaption>App with setWebContentsDebuggingEnabled(false) appium log</figcaption></figure><p>App with setWebContentsDebuggingEnabled(true)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2503b970b7be46a3d08f7bd652c53be/href">https://medium.com/media/d2503b970b7be46a3d08f7bd652c53be/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*CIehKHrZ_2hRnJvZN0oJ2A.png" /><figcaption>App with setWebContentsDebuggingEnabled(true) appium log</figcaption></figure><h4><strong><em>2. Cannot execute test script if the device chrome version is mismatch with the Appium chrome driver version.</em></strong></h4><p><strong>Problem</strong></p><p>If we execute test script where the device chrome version is mismatch with the Appium chrome driver version, it leads to an error saying for ex:</p><pre><em>selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing ‘value’ (Session info: chrome=65.0.3325.109) (Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2)</em></pre><p>This will get because for mobile app <strong>chrome version 65.0.3325.109.</strong></p><p><strong>Link to refer:</strong> <a href="https://discuss.appium.io/t/unknown-error-call-function-result-missing-value/22135">https://discuss.appium.io/t/unknown-error-call-function-result-missing-value/22135</a></p><p><strong>Solution</strong></p><p>We need Appium chrome driver <strong>version 2.38. </strong>Once we update Appium chrome driver version to 2.38, we can execute our test scripts. <br>Use below command to update Appium chrome driver version.</p><pre><em>npm install appium-chromedriver_version=&#39;&lt;required version&gt;&#39;</em></pre><p><strong>Links to check chrome driver version:</strong><br> <a href="https://chromedriver.storage.googleapis.com/index.html">https://chromedriver.storage.googleapis.com/index.html</a><br> <a href="https://sites.google.com/a/chromium.org/chromedriver/downloads">https://sites.google.com/a/chromium.org/chromedriver/downloads</a></p><p>That’s it folks and thanks for reading!.</p><p>These are the links to learn more about hybrid &amp; native apps, appium installation, importance of automating mobile apps and automation platforms.</p><ul><li><a href="https://medium.com/@AlamBushra/appium-installation-d70c7f4b8e36">Appium installation</a></li><li><a href="https://medium.com/@app_developers/native-vs-hybrid-app-728f341ff9e1">Native &amp; Hybrid apps</a></li><li><a href="https://medium.com/intuz/top-10-automated-testing-tools-for-mobile-apps-8d9380e1757f">Mobile automation platforms</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdf5b912c489" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aeturnuminc/resolving-practical-issues-associated-with-test-automation-in-android-using-appium-bdf5b912c489">Resolving Practical Issues Associated with Test Automation in Android using Appium</a> was originally published in <a href="https://medium.com/aeturnuminc">Aeturnum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>