Get control of an existing open window using Teststake White - ui-automation

For some reason, TestStake.White is not able to open an old windows application (which i can successfully run(win 7) by doubliclicking on the exe). I want to use an existing window to perform some action using White. I have no idea as to how to take control of an already opened window using White.
I tried to open the exe using batch command, but I still couldn't get any success. It shows me a yellow screen(app background) with no mouse control. Hence I want to launch the app manually and perform some automation actions on it.

If you know the text in the title bar of the window:
using TestStack.White;
public static class Demo
{
public static Window GetWindow(string windowTitle)
{
var window = Desktop.Instance.Windows().FirstOrDefault(x => x.Name == windowTitle);
}
}

Related

why are plugin connected signal not working after saving?

I've created a plugin and it works fine when I open the project but as soon as I press ctrl + s to save the scene for the first time since opening, the buttons on the plugin (Close_btn in this case) stop working
tool
extends EditorPlugin
var Key_Btn=null;
var UI=load("res://addons/Plugin_Name/UI.tscn").instance();
func show_UI():
get_editor_interface().add_child(UI)
func close_UI():
if(get_editor_interface().has_node(UI.name)):
get_editor_interface().remove_child(UI);
func _enter_tree():
Key_Btn=Button.new();
Key_Btn.text=" Key ";
Key_Btn.flat=true;
add_control_to_container(CONTAINER_CANVAS_EDITOR_MENU,Key_Btn)
Key_Btn.connect("pressed",self,"show_UI")
func _exit_tree():
close_UI();
remove_control_from_container(CONTAINER_CANVAS_EDITOR_MENU,Key_Btn)
This is what the plugin button looks like:
The UI that pops up when you press the button:
How do I solve this?
I tried your code. I did modify the UI as I describe below. However, with your code, at no point the UI or the button to open it stopped working.
This is what I tried (closing and opening the project between tests):
Saving, then opening the UI. Then closing the UI and opening it again.
Opening the UI, then closing it, then saving, then opening it again.
Opening the UI, saving with the UI open, closing it, then opening it again.
I tested on Godot 3.3, 3.4,, 3.4.3 and 3.5 beta 1.
Since you have a Button called Transparent Background. I had it set to Full Rect, and set the alpha of its self_modulate to make it transparent. Consequently it won't let me interact with anything in the editor…
To be able to close the UI, I had to add a script to Control Main that looks like this:
tool
extends Control
func close():
if is_inside_tree():
get_parent().remove_child(self)
Don't forget to make a tool script.
And I connected the press signal from the Transparent Background and Close_btn to the close method I added.
An alternative would have been to emit a signal from the UI and on the EditorPlugin have it connected to close_UI… I didn't do that because I didn't want to change your code. And since it all worked with that code, I can say that issue for you is not that code.
Also be aware that you load an instance the UI scene on the initialization of your EditorPlugin. In consequence…
Some modifications to that scene won't be reflected on the EditorPlugin until you disable and enable it again, or load the project again.
And I say "some modifications", because you will see reflected the modifications to the resources it had when loaded. For example, I can modify the script I attached, or re-import texture, and so on. However, if I replace the resource with a new one, I will see the old resource on the already loaded UI.
With that in mind, I tried modifying the script I attached to introduce an error and saved… And the UI still appears. Except, since the script I attached was not working, I could not close the UI, so I had to close Godot altogether.
In fact, the only way I have been able to make the button stop working after saving was by introducing an error in the EditorPlugin code and saving. I can only assume this is what happened to you.

Disable bringing app window to front. After closing another window

I have OSX App that contains 2 NSWindowControllers. My problem is described by few steps:
Launch the app with 2 windows
Select the window of another app
Put 1 of the windows in front of anther app window and the second will stay in the bottom.
Close the window in the top.
The second window will be brought to the top immediately.(I need to fix it and keep my second window in the bottom.)
Also I hope to cancel this behavior. Not just make an opposite action like NSApp.hide()/NSApp.deactivate etc.
I know that it is a default behavor(e.g. Finder do the same), but I have to disable it. Also the case I've just described is a bit strange, but in my app it is really needed =(
I've tried to override becomeKey, becomeMain for main window, but it hasn't help.
override func becomeKey() {
}
override func becomeMain() {
}
PS
I'll be thankful for any ideas.

Eclipse RCP DirectoryDialog not showing initial directory

Im using a DirectoryDialog like this:
public static String showDialog(Composite parent, String path)
{
log.debug("Showing submission directory dialog");
Shell shell = parent.getShell();
DirectoryDialog dialog = new DirectoryDialog(shell);
dialog.setFilterPath(path);
return dialog.open();
}
Works fine, but the view is not showing the directory provided by the path. It is selected but not shown:
Should be something like this:
Any ideas?
Thanks in advance!
IMHO it is not possible. These are native dialogs of underlying OS, so the behaviour of these dialogs may change one OS to other.
Automatic scrolling to the selected folder may not possible.
Also check whether it works: Open DirectoryDialog and hide the hidden folders, so automatically the filter folder will be visible.

JavaFX popup hidden when stage is in fullscreen mode

I am trying to popup a dialog over my fullscreen primary stage in javafx. When I create my popup, it is unexpectedly hidden behind my fullscreen primary stage until the stage is removed from fullscreen mode (via ESC). If I make my primary stage maximized and undecorated instead of fullscreen, then my popup will appear on top of the primary stage as expected.
Am I missing something about how fullscreen mode is different than maximized and undecorated mode? Am I using fullscreen mode improperly?
I am using java version 1.8.0_20 on CentOS 6.5 with Gnome.
Here is my SSCCE:
import javafx.application.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.stage.*;
public class TestApplication extends Application {
private Stage primaryStage;
public static void main(String[] arguments) {
launch(arguments);
}
public void start(Stage stage) {
this.primaryStage = stage;
// Create a fullscreen primary stage.
primaryStage.setTitle("Main Stage");
primaryStage.setScene(new Scene(createRoot()));
primaryStage.setFullScreen(true);
primaryStage.show();
}
private Parent createRoot() {
Button button = new Button("Show popup");
button.setOnAction((event) -> showPopup());
return button;
}
private void showPopup() {
// Create a popup that should be on top of the primary stage.
Stage popupStage = new Stage();
popupStage.setScene(new Scene(createPopupRoot()));
popupStage.setTitle("Popup Stage");
popupStage.initModality(Modality.WINDOW_MODAL);
popupStage.initOwner(primaryStage);
popupStage.show();
}
private Parent createPopupRoot() {
return new Label("This is a popup!");
}
}
After repeating this problem with java version '1.8.0_40', I finally found how to fix this problem!
popupStage.initStyle(StageStyle.UTILITY);
Stage.initStyle(StageStyle) -- JavaFX 8
Giving the popup a style of StageStyle.UTILITY seems to keep the popup in front of the fullscreen window even when clicking outside of the popup.
I saw this same issue when using the new Alert class in java 1.8.0_40, and setting the style to StageStyle.UTILITY fixed that as well (Dialog.initStyle(StageStyle) -- JavaFX 8).
I don't know why this works.
Side Note:
It looks like removing the call to popupStage.initOwner(...) allows the popup to appear above the full screen application, but clicking outside of the popup causes the popup to disappear.
Assuming you're on a Mac, this is a known issue, which is fixed in 8u40. You may need to use the ea version until the full release.
The basic history of this bug is that JavaFX implemented its own full screen implementation, in order to support OS X versions prior to 10.7 (which didn't have a native full-screen mode). That implementation uses an "exclusive mode", which prevents other windows from showing. This can get pretty bad: for example ComboBoxs won't work... The issue is fixed in 8u40 by using the native mode (since OS X versions prior to 10.7 are no longer supported anyway).
Note that if you don't programmatically set full screen mode, and allow the user to go to full screen using the Mac OS button on the window title bar, then the issue should not arise.

Compact-Framework: Minimise and restore isn't working

I've written an application with the following in the Program.cs:
rsCursor.Wait();
// Load the settings
rsAppConfig.LoadConfig("iVirtualDocket.exe.config");
fSplash splash = new fSplash(IvdConfig.VERSION);
splash.Initialise();
DialogResult result = splash.ShowDialog();
rsCursor.Go();
if (result == DialogResult.Yes)
{
IvdInstances.Main.Initialise();
Application.Run(IvdInstances.Main);
}
I use full screen on all my forms, so there is no X button, however I thought using Form.Close() performed the same function?
I want to be able to minimise my application from my main menu (Main) and then have it instantly appear again when the user re-runs the application. At the moment, my application executes the loading screen every time I re-run the application.
What am I doing wrong?
Thanks in advance.
EDIT: I need to be able to detect when my application is running and then restore the main menu when it is so that it's not constantly loading itself into memory.
Form.Close closes the Form. There is no Minimize - use Hide and Show.
[System.Runtime.InteropServices.DllImport("coredll.dll")]
static extern int ShowWindow(IntPtr hWnd, int nCmdShow);
ShowWindow(this.Handle, SW_MINIMIZED);
This did the trick, this.Hide() didn't work as it didn't maximise the window again when I re-ran the app.