do not show keyboard in appium test on IOS - ios-simulator

How can i make appium use physical keyboard instead of soft keyboard?
when running a code with xcode no keyboard is shown at all, but with appium the soft keyboard is shown.
i found driver.hideKeyboard() and Dismissing keyboard in appium test on iOS, but they are about how temporary hide keyboard.
The other solution was using Command + K which do the trick, but appium does not do that automatically and if you do that manually when appium starts simulator, test will fail!!

Try the solution as mentioned here by me:
Toggle Software Keyboard for entire test suite in appium python

You can use sendKeys directly to your desired field. it is independent of keyboard. So i think it will work for you. Example code is below
public void usingSendKey(By by, String text){
WebElement element = null;
element = driver.findElement(by);
try{
element.clear();
}
catch(Exception e){
}
element.click();
element.sendKeys(text);
}

Related

How to swipe iOS emulator screen

As soon as I upgraded my local version of Appium, all my swipe logic stopped working. I moved to the non deprecated API, and but I'm till not able to observe swipes. I'm pretty sure I'm just not using the coordinate system correctly but I'm not sure how. I want to swipe vertically down the screen of an iOS simulator to refresh a list view.
Any pointers on how to treat properly swipe and why, and what the mechanics of it are?
Here is my code for swiping
PointOption fromPoint = PointOption.point(
topView.getLocation().x,
topView.getLocation().y);
PointOption toPoint = PointOption.point(
bottomView.getLocation().x,
bottomView.getLocation().y);
new TouchAction(user.mDriver)
.press(fromPoint)
.moveTo(toPoint)
.release()
.perform();
I upgraded my version of Appium and my Java client, but those improvements didn't fix the swiping.
Apparently, one must add a wait duration for the swipe to take place.
WaitOptions waitOptions = WaitOptions.waitOptions(Duration.ofMillis(500));
new TouchAction(mUser.mDriver)
.press(fromPoint)
.waitAction(waitOptions)
.moveTo(toPoint)
.release()
.perform();
This is my code it is working fine for IOS simulator swiping .
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", "left");
js.executeScript("mobile: swipe", scrollObject);

Xamarin Forms Hardware Button CrossPlateform

I don't find any solution or explaination to use the BackButton hardware (Android & WinPhone 8.1) from MyPage, defined in the PCL part.
Is it possible to handle that button from a Portable Class Library?
Thank
Yes it is. You can ovveride default behaviour for back button in pcl. For example if you want to deactivate it, you can use in the page you want:
protected override bool OnBackButtonPressed()
{
return true;
}

Make JavaFX window active

I am trying to make a JavaFX application (running in the background to show up (set visible)) by a specific keystroke and to make the window the active window immediately. Therefore I set the primary stage alwaysOnTop-property true, call stage.toFront() and finally call stage.requestFocus(). Afterwards I request focus for a text field. When the window is made visible I would like to instantly start typing into the text field.
However, when I for example have a Ubuntu-terminal selected and make the window visible and start typing, the application is shown on top of everything, however, the typing goes to the terminal. The application window is not active! Nevertheless, the focused property of the stage is true. Is that a bug or am I missing something? Is it OS related?
Edit: I am willed to give my little hack-around for this problem that I am using at the moment, because the internet is suggesting, that a lot of people are facing this problem: Since I am working on a linux maschine I have access to the wonderful tool wmctrl. It is part of most standard repositories. wmctrl -a WINDOWNAME sets the window with the name WINDOWNAME active. For now, I simply call this tool from my source code when I need the window to be active. Since this is more of a dirty hack than any thing else, I sure want to get rid of it.
Not perfect, but it works:
Platform.runLater(() ->
{
//primaryStage.setAlwaysOnTop(true);
//primaryStage.setAlwaysOnTop(false);
primaryStage.setIconified(true);
primaryStage.setIconified(false);
});
If your node is not getting focused, try wrapping requestFocus() in a Runnable and call Platform.runLater():
final TextField text = new TextField();
Platform.runLater(new Runnable() {
#Override
public void run() {
text.requestFocus();
}
});

WebDriver open rich:popupPanel

We are testing an application with Selenium WebDriver. HTMLUnitDriver is our choice (because of non-gui-testing) and sometimes IEDriver for Presentationpurposes. Anyway, i try to perform a click on a button, this one has to open an rich:popuPanel(modal=true) and click a Link on that Panel. With IEDriver that's no problem, but with HTMLUnitDriver the popupPanel doesn't open. I tried to perform these clicks in several ways:
JavascriptExecutor jsdriver = (JavascriptExecutor) driver;
jsdriver.executeScript("$('input[id$=freigabeCmd_id]').focus();");
//below are the other tries
// jsdriver.executeScript("$('input[id$=freigabeCmd_id]').click();");
// jsdriver.executeScript("window.document.getElementById('editorViewForm_id:freigabeCmd_id').click()");
// jsdriver.executeScript("arguments[0].click()", freigabeButton);
// jsdriver.executeScript("arguments[0].fireEvent('onclick');", freigabeButton);
further i tried it the "normal way":
freigabeButton.click();
//below are other ways i found here on stackoverflow
// freigabeButton.sendKeys(Keys.ENTER);
// new Actions(driver).moveToElement(freigabeButton).clickAndHold().release().build().perform();
but nothing brought me to get the popupPanel "visible". Anyone got an idea why?! i'm really stuck right now. If you need more Informations pls let me know.
using: HTMLUnit Version 2.12 and latest SeleniumVersion
It might be that your webapp uses javascript to launch the rich pop-up panel, and you are running HtmlUnitDriver with javascript disabled? It is disabled by default, so you need to explicitly enable it.

Qt app, minimized to tray, on Win7 there's a problem with focus stealing prevention

I have a Qt app which, like Skype, is usually minimized to the tray. When the user clicks the tray icon, the app window is shown.
This works fine on Linux and WinXP. On Win7 however, the app window is shown but stays below the other windows - unless the currently active window is Qt Creator, or was my app (before I minimized it to tray). So it must have something to do with focus stealing prevention.
I know Skype is written in Qt, and they don't have that problem, so it must be fixable.
Here's my code:
void MainWindow::toggleVisible(QSystemTrayIcon::ActivationReason reason)
{
if (QSystemTrayIcon::Trigger == reason)
setVisible(!isVisible());
}
[Edit]
It turns out I had to call activateWindow. I changed my code to:
void MainWindow::toggleVisible(QSystemTrayIcon::ActivationReason reason)
{
if (QSystemTrayIcon::Trigger == reason)
{
if (isVisible())
{
hide();
}
else
{
show();
raise();
activateWindow();
}
}
}
It works on Win7 now.
I use the following code to make my application visible when clicked from tray;
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
this will handle the case its in minimized and you click the tray icon.

Resources