WebDriverException while setting text in input box of App in iOS simulator

While automating the iOS build using Katalon studio on simulator, I am unable to set text of an input field. Whenever I submit the text to be set, it throws the exception :
“WebDriverException”. The error is unknown.

The specifications are as under :
Xcode version : 9.4.1
Katalon studio : 5.7.1
Mac OS version : 10.13.6

Hope to find a solution soon.

Regards,
Chand

Hi Chand,

Could you share any log files from the console output? There might be an error in there that doesn’t show in any error dialogs.

Thanks,

Chris

Hi Chris,

The same is working fine now for setText field. All I did was to restart my device after making changes to my WebDriverAgent.

Now, there is a View Password icon on my page which is working fine as expected when the script is recorded. But the same does not work when test case is executed. It does not get tapped as written in the script. The same button is within the text field of password. I doubt if it changes the object at runtime.

Hi Chand,

If possible, I’d like to know the structure of the screen elements at the time when the password icon is showing. Could you log out the XML contents of the screen and share them (strip out anything proprietary/confidential first)? You should be able to do that by putting the following import statements at the top of your test case:

import com.kms.katalon.core.logging.KeywordLogger
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactoryimport io.appium.java_client.AppiumDriver

Then in the code for your test, add the following right before tapping the password icon:

AppiumDriver<?> driver = MobileDriverFactory.getDriver()
KeywordLogger log = new KeywordLogger()
log.logInfo(driver.getPageSource())

When the test runs, you should see an entry in the Log Viewer for “Statement - log.logInfo(driver.getPageSource())” that shows the start of the XML for the screen. If you tap on it, you’ll see all of the XML for the screen on the right-hand pane. If you could copy and share that, I can help troubleshoot why the scrolling isn’t working. (I recommend putting it into a text editor first to remove any sensitive data, like package names, etc.)

Thanks,

Chris

Hi Chris

PFA XML received from the above given method.

              <XCUIElementTypeOther type="XCUIElementTypeOther" name="Save Password" label="Save Password" enabled="true" visible="false" x="8" y="229" width="359" height="46">  

In the file, the element just above “Save Password” is “View Password” icon highlighted here in bold. Appium is not able to find this element on page.

But, also I have observed that height ,x and y values of the above mentioned element are different to that of captured using Object Spy.

To make it easier, the actual HTML code for it is as under :

     <div id="page-login-username-form-field" class="form-field" style="border-bottom: #fff solid 1px;">

        <input id="page-login-username" type="email" placeholder="Email" alt="Email" class="ic-User">

      </div>

      <div id="page-login-password-form-field" class="form-field">

           <input id="page-login-password" type="password" autocapitalize="off" placeholder="Password" alt="Password">

            **  <span id ="page-login-show-password" class="eye_icon"></span>**

       </div>

       <div class="checkbox">

              <input type="checkbox" name="checkbox-1" id="page-login-save-password" class="custom" />

              <label for="page-login-save-password">Save Password</label>

        </div>

        <div class="redBtn red-btn-wrap">

              <input type="button" id="page-login-submit" href="#" value="Login">

         </div>

In the above mentioned code, the highlighted code is for “show password”.

Thanking you,
Chand

logs_file.txt

@Chris Trevarthen - Hi Chris,
Kindly help

Hi Chand,

From the look of it, you’ve got a native app with a web view, too. Is that accurate? From what I can tell, Katalon (and Appium, underlying) is showing only basic element info for the web view, which is why you’re not able to find the element you’re looking for; it’s not providing a structure similar to the HTML.

I was looking at some docs that might be helpful in switching to a web view mode:

https://docs.katalon.com/katalon-studio/docs/mobile-switch-to-web-view.html

I wonder if you can call Mobile.switchToWebView() in your test before looking for the show password icon. You may then be able to use Katalon’s WebUI functions to get elements, something like WebUI.click():

https://docs.katalon.com/katalon-studio/docs/webui-click.html

- Chris

1 Like

Chris Trevarthen said:

Hi Chand,

From the look of it, you’ve got a native app with a web view, too. Is that accurate? From what I can tell, Katalon (and Appium, underlying) is showing only basic element info for the web view, which is why you’re not able to find the element you’re looking for; it’s not providing a structure similar to the HTML.

I was looking at some docs that might be helpful in switching to a web view mode:

https://docs.katalon.com/katalon-studio/docs/mobile-switch-to-web-view.html

I wonder if you can call Mobile.switchToWebView() in your test before looking for the show password icon. You may then be able to use Katalon’s WebUI functions to get elements, something like WebUI.click():

https://docs.katalon.com/katalon-studio/docs/webui-click.html

- Chris

Thank you again Chris.

I am able to obtain elements from their ID and class name now.

But, a checkbox on the same page is not getting checked. Its giving the following error :

Unable to check object ‘Object Repository/LoginPage/Save Password’ (Root
cause: org.openqa.selenium.ElementNotVisibleException: Element is not
currently visible and may not be manipulated…

I used the following solutions :
WebUI.click(…
WebUI.check(…

Neither of it worked for me.

Thanks,
Chand

Hi Chand, is it possible that the checkbox is actually not visible at that time - is it hidden by the keyboard?

It’s also possible that now that you’ve switched to the web view, you’ll need to access the elements differently; the “Save Password” object you originally created through the Mobile Spy or Recorder might not have the same properties when in web view mode. Could you do the logger from my previous comment after switching to the web view and see what it shows for the page elements?

- Chris

Chris Trevarthen said:

Hi Chand, is it possible that the checkbox is actually not visible at that time - is it hidden by the keyboard?

It’s also possible that now that you’ve switched to the web view, you’ll need to access the elements differently; the “Save Password” object you originally created through the Mobile Spy or Recorder might not have the same properties when in web view mode. Could you do the logger from my previous comment after switching to the web view and see what it shows for the page elements?

- Chris

Hi Chris,
There is no keyboard visible on the page while I look for the checkbox through script.

PFB xml of page source created at runtime :

<div id="page-login-username-form-field" class="form-field" style="border-bottom: #fff solid 1px;">

    <div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset" __plugindomid="pgm698814876643"><input id="page-login-username" type="email" placeholder="Email" alt="Email" class="ic-User" autocomplete="off"></div>

</div>

<div id="page-login-password-form-field" class="form-field">

   <div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset ui-focus" __plugindomid="pgm1149651946391"><input id="page-login-password" type="password" autocapitalize="off" placeholder="Password" alt="Password" autocomplete="off"></div>

      <span id="page-login-show-password" class="eye_icon"></span>

</div>

<div class="checkbox">

      <div class="ui-checkbox" \_\_plugindomid="pgm62455073903"><label for="page-login-save-password" class="ui-btn ui-corner-all ui-btn-inherit ui-btn-icon-left ui-checkbox-off" \_\_plugindomid="pgm1441405008042">Save Password</label><input type="checkbox" name="checkbox-1" id="page-login-save-password" class="custom"></div>

</div>

<div class="redBtn red-btn-wrap">

      <div class="ui-btn ui-input-btn ui-corner-all ui-shadow" __plugindomid="pgm613982113048">Login<input type="button" id="page-login-submit" href="#" value="Login"></div>

</div>

Regards,
Chand