Is there anyway to dismiss the iPhone keyboard or disable it from popping up at all while Appium tests are being run?
driver.hideKeyboard() doesn't work, half the time a "DONE" or "RETURN" button isn't present and I can't just tap randomly on the screen because I can not guarantee that the code won't accidentally tap a link or active element.
I don't understand why it doesn't just function like on Android and just never display the keyboard when using driver.sendKeys().
I've noticed the same and did a workaround by doing it like an actual user and clicking on the hide keyboard button. You might want to add a check to only click if the element is visible to avoid trying to close the keyboard when it's not there.
driver.findElement(By.xpath("your_keyboard_close_button")).click();
Related
I would like to check if the soft keyboard is visible at a certain moment. I'm not talking about listening to its open/close event. It is the moment after the keyboard is already fully opened and before the keyboard starts to close. So whether it is on the screen now or not.
I did google around and all I got is about how to listen to the keyboard's open/close event.
I've just found a workaround solution in "Are you open?" section in the following link.
How to detect if the android keyboard is open
It's basically comparison between the current heights of root view and visible frame.
Android Keyboard Picture
I'm doing automated testing to send a text. The app does not have a "submit" button but rather by clicking the green check of the android keyboard, it will submit the text. UIAUTOMATORVIEWER does not show the element or any form of id when it comes to the android keyboard.
Thing's that I have tried is:
driver.sendKeys(Keys.ENTER)
sendKeys(66) (66 = ENTER)
For key events, you need to use driver.pressKeyCode()
So what you want is driver.pressKeyCode(66). If you want it to be even more readable:
driver.pressKeyCode(AndroidKeyCode.ENTER)
Also keep in mind pressKeyCode only works for AndroidDriver.
By default, Android dismisses the on-screen keyboard when a user presses Send on the keyboard or clicks on a Button on the UI. However, I am building a messaging app, and would like to keep the soft keyboard on the screen even if a user clicks Send or any other button on the UI. This is the standard behavior for messaging apps (Facebook's messages functionality, for example, or Google Hangouts), so I know it can be done.
I have tried the suggestions here (returning true from the onEditorAction method of OnEditorActionListener) and here (InputMethodManager.SHOW_FORCED). The first seems to work on API 2.3, but was unsuccessful on 4.2. The latter didn't work at all.
Any suggestions would be appreciated.
I have an app with ListView in it and I added search functionality to it. When I press on EditText and it opens keyboard, it pushes everything in the layout along with it.
Normal layout:
With keyboard:
As you can see; the ad, play button, seekbar are all pushed up along with the keyboard, but I don't want that. Is there a way I can avoid this?
I tried adding this to Manifest file:
android:windowSoftInputMode="stateUnchanged"
But that doesn't work.
You probably want to use "adjustPan".
From the documentation:
The activity's main window is not resized to make room for the soft
keyboard. Rather, the contents of the window are automatically panned
so that the current focus is never obscured by the keyboard and users
can always see what they are typing. This is generally less desirable
than resizing, because the user may need to close the soft keyboard to
get at and interact with obscured parts of the window.
Is there an equivalent for C's getch() in Android or Java? I want the execution to stop until the user does some action, like tap on the screen or maybe press one of the hardware buttons like volume control or whatever is available. Another option would be to show a modal message box window, which does not let the program continue until the user presses on OK. Is it possible to do this in a simple way in Android? What is the simplest way to get something equivalent to getch() function in android?
I need to be able to use this in a Thread as well
There's no getch() equivalent function/method in java.
You must event handlers to do that.
Like having click handler for button,Which let you to some stuff on onClick() method,Once you click the button.
This example might helpful:Button Click Listeners in Android
There's an event listener for android like onCLickListener. Then you can also used Jdialog then set its .isEditable value to false like dialog.isEditable(false);