How to handle the keyboard not present issue in iOS automation - appium-ios

I am writing the script to automate a mobile app on iOS and even since the iOS version upgraded to 14, I’ve seen this error. I even tried to invoke the keyboard by clicking on the text entry field first but that didn’t help. Any suggestions on how to handle this or anyone handled this in Appium?
Error Domain=com.facebook.WebDriverAgent Code=1 "The on-screen keyboard must be present to send keys" UserInfo={NSLocalizedDescription=The on-screen keyboard must be present to send keys}
Thanks,
Nus

Related

Connection to daemon was invalidated

My app is using Firebase Analytics and I believe starting in iOS 13.2 started getting the errors described here: Why I get the console warning: [Process] kill() returned unexpected error 1 when I load a WKWebView in iOS13.2?
I guess it wasn't a big deal
Since I planned for my app to go live in January, I began bigger tests in physical devices. I noticed after a while the app started to behave erratically, specially after receiving a [general] Connection to daemon was invalidated error. This doesn't occur in the simulator
Searching the internet I found a post that describes the same problem: https://forums.developer.apple.com/thread/124306
In my case, only Firebase seems to be calling WKWebView, but every time I open the UIMenuController I get the error described in the console and the app appears to be missing inputs. This is specially troublesome with UIScrollViews, which my app uses a lot. The pinch gesture seems to work at will. On an iPhone 6s, the issue isn't as noticeable, on an iPad, it's like a 50% chance the pinch gesture will work properly
Outside of removing Firebase, is there a way to mitigate this issue?
1 June 2020: The console message still persists, however, I have seemed to resolve the UIScrollView issue by deactivating delaysContentTouches, now the pinch gesture seems to work most of the time
23 October 2020 If anyone notices their app starting to behave erratically with no apparent reason I HIGHLY suggest to test it on an iOS 13 physical device if possible. Seems that Apple removed the warning from iOS 14, but testing it on iOS 13 you can pin point the exact reason after the warning appears in the console
Upon further testing, I've reduced the view down to a dead-simple UI view with a single SwiftUI TextField and the 'Connection to daemon was invalidated' still appears after I type the first character into the field. Soon thereafter the app crashes with a sigAbort. (So I don't think the reason is the UITextView wrapper I was using in the previous post). Once the invalidated message appears the app is doomed to crash, not right away but soon thereafter.
I have no idea what causes the 'invalidate' message and a Google search seems to imply that no-one else does either. Some folks appear to have made (experimental?) changes to their UI that stops the message but it appears to be impossible to determine a definite cause. (and like before it only occurs on a real phone)
Same issue without using Firebase at all. What I did: Delete build folder and compile again. Issue does not appears again.
On Xcode:
Clean the Build Folder
This will delete all of the products and intermediate files in the build folder. To clean the build folder you can use the shortcut Command+Option+Shift+K or Menu Bar → Product → Hold Option Key → Clean build Folder.
On Flutter:
Just delete build folder.

Expo: "Something went wrong" immediately on start

I have used Expo a few times successfully before, but for a few days now, I am unable to get into the Expo App. Whenever I open it, I see the Expo icon for a few seconds up to even minutes, and then it redirects me to the blue "Something went wrong" screen, as if I had tried to open an app.
But I didn't! It doesn't even let me scan a QR code, it just always shows this error. If I click the back button in the app, it simply terminates. I have ensured that it is the latest version and already reinstalled it once.
It seems like it somehow had locked itself onto an old, now non-existant server, and kept at it after reinstalling the app. Here is how I solved the problem:
In the metro bundler, choose connection type "Tunnel" and copy and send the URL to your phone. If you then click on it on your phone, it should redirect to the expo app. After that it got unstuck and I could finally use it normally with the QR code again!
The tools sometimes do get locked into this state.
Close and restart all components (Expo cli, browser tabs and clients) making sure to:
Kill any stray processes on the server (you need to check Activity Monitor / Process Explorer or similar depending on your platform)
Force quit all client devices and simulators using the correct method for each platform. To verify that the client process has actually been killed, check that the app splash screen is displayed for a short while when invoking it.
Clear the Expo cache when starting again: $ expo start --clear
I ran into the same issue. Solved it by going to the left sidebar in the Metro Bundler and sending a link via email!
I've tried many of the solutions and only one worked for me (which i found trying random things). I already had 'allow display over other apps' turned on (Android/OnePlus 6t) and didn't think it had anything to do with that. But I tried this...
Close the Expo app, go the the app settings and turn off 'allow display over other apps', open the expo app and [when prompted] turn on 'allow display over other apps' again.
That seems to work in my case - at least until the next time.

Toggle Software Keyboard for entire test suite in appium python

Currently I am writing iOS tests using Python Appium and would like to completely hide the software keyboard which pops up whenever you have to type something. I am already aware of driver.hide_keyboard() function but it's a pain to include it everywhere in tests.
I was going over the Appium Desired Capabilites but couldn't find anything that will disable the software keyboard. Appreciate if anyone can help me here?
To disable soft keyboard in iOS simulator do this:
Simulator Menu > Hardware > Keyboard > Connect Hardware Keyboard (enable it)
Even if you quit and reopen the simulator, the selection will stay. I'm not sure what happens when you factory reset the simulator.
screenshots attached.

While executing appium test on android device, is it possible to type text using the android keyboard

I am testing android device using appium from Mac machine. Sendkeys is failing on a particular page. Following is the description of the issue i already posted. Sendkeys fails on android appium driver.
So I want to know is there any other possibilites to resolve the issue. I spent hours in searching answer for it. But all i can find is pressing back, home buttons. I want to type characters like 'k' , 's' using the android keyboard. Any suggestions?
you can use virtual keyboard on simulator.
if you use genymotion emulator, you can choose to set use or not use virtual keyboard.
and if you use send_keys function failed, you can try element.set_text('your text') instead(python client)
in my case, when i run test on a real device, default call out the android keyboard.
maybe you can provide more details, paste your scripts etc.

How to display the Soft Keyboard in Air Debug Launcher (ADL)

I've searched Google for about 1,5h now and i can't find a good answer.
Is it possible to display the Soft Keyboard when debugging using ADL?
If i use the existing properties I still don't see it.
I want to check if my layout looks well when the Soft Keyboard appears, but for some reason I don't see it coming in ADL (Adobe Debug Launcher).
I don't have a tablet to test it on for now so that isn't a solution.
Am i doing something wrong whereby I don't see the soft keyboard or doesn't it exist in ADL?
ADL is just the Flex debugger program. When I use ADL to launch my app on an Android device; there are no issues getting the soft keyboard to show up. When I use ADL to launch an app in an emulator, I have never seen the soft keyboard come up. This is not supported with the emulator included with Flex / Flash Builder.
In my experience the availability of the soft keyboard depends on the context you're running the app in (Debugger vs Device) and has nothing to do w/ ADL.
Does that answer your question?

Resources