| ZennoLab.Emulation Assembly > ZennoLab.Emulation Namespace > Emulator Class : ButtonClick Method |
Type: System.String
The header of the window.
Type: System.Boolean
true if need to show the window on top of all; otherwise, false. Default value is false.
public static string ButtonClick( string windowName, string buttonName, bool topMost )
Type: System.String
The header of the window.
Type: System.String
The text displayed on the button.
Type: System.Boolean
true if need to show the window on top of all; otherwise, false. Default value is false.
Type: System.String
The answer with information about the success of the current command's execution. If current command was successful then this answer is "ok"; otherwise message describing the error.
There are several ways of calling this method. The parameter topMost have the default value and you can call the method without this parameter.
This method searches the button by the caption and does not case sensitive.
// show the save file dialog string result = Emulator.MouseClick("Simple window", MouseButton.Left, MouseButtonEvent.Click, 200, 200); // wait a little bit System.Threading.Thread.Sleep(2000); // if mouse click was successful if (result == "ok" && !Emulator.ErrorDetected) { // click on button with caption "Save" result = Emulator.ButtonClick("Save as", "Save"); // make answer if (result == "ok" && !Emulator.ErrorDetected) return "All done"; else return "Fail"; }
// show the save file dialog $result = ZennoLab\Emulation\Emulator::MouseClick("Simple window", MouseButton::Left, MouseButtonEvent::Click, 200, 200); // wait a little bit System\Threading\Thread::Sleep(2000); // if mouse click was successful if ($result == "ok" && !Emulator::ErrorDetected) { // click on button with caption "Save" $result = ZennoLab\Emulation\Emulator::ButtonClick("Save as", "Save"); // make answer if ($result == "ok" && !ZennoLab\Emulation\Emulator::ErrorDetected) return "All done"; else return "Fail"; }
Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows Seven