diff --git a/TestApplications/src/Notifier/App.config b/TestApplications/src/Notifier/App.config
index 8e15646..4bfa005 100644
--- a/TestApplications/src/Notifier/App.config
+++ b/TestApplications/src/Notifier/App.config
@@ -1,6 +1,6 @@
-
+
-
+
-
\ No newline at end of file
+
diff --git a/TestApplications/src/Notifier/Notifier.csproj b/TestApplications/src/Notifier/Notifier.csproj
index 3fd2b46..2c8531b 100644
--- a/TestApplications/src/Notifier/Notifier.csproj
+++ b/TestApplications/src/Notifier/Notifier.csproj
@@ -8,9 +8,10 @@
WinExe
NotifierTest
Notifier
- v4.5
+ v4.8
512
true
+
AnyCPU
diff --git a/TestApplications/src/Notifier/Properties/Resources.Designer.cs b/TestApplications/src/Notifier/Properties/Resources.Designer.cs
index 25ad1eb..a3bcadc 100644
--- a/TestApplications/src/Notifier/Properties/Resources.Designer.cs
+++ b/TestApplications/src/Notifier/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace NotifierTest.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/TestApplications/src/Notifier/Properties/Settings.Designer.cs b/TestApplications/src/Notifier/Properties/Settings.Designer.cs
index 800a553..6e26e3b 100644
--- a/TestApplications/src/Notifier/Properties/Settings.Designer.cs
+++ b/TestApplications/src/Notifier/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace NotifierTest.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/TestApplications/src/WpfApplication/App.config b/TestApplications/src/WpfApplication/App.config
index 877624e..5ffd8f8 100644
--- a/TestApplications/src/WpfApplication/App.config
+++ b/TestApplications/src/WpfApplication/App.config
@@ -1,6 +1,6 @@
-
+
diff --git a/TestApplications/src/WpfApplication/MainWindow.xaml b/TestApplications/src/WpfApplication/MainWindow.xaml
index fd6f759..b0dae22 100644
--- a/TestApplications/src/WpfApplication/MainWindow.xaml
+++ b/TestApplications/src/WpfApplication/MainWindow.xaml
@@ -7,6 +7,8 @@
mc:Ignorable="d"
Title="FlaUI WPF Test App"
Height="533.931" Width="629.303"
+ KeyDown="OnKeyDown"
+ KeyUp="OnKeyUp"
ResizeMode="CanResize">
@@ -177,6 +179,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TestApplications/src/WpfApplication/MainWindow.xaml.cs b/TestApplications/src/WpfApplication/MainWindow.xaml.cs
index 59fd605..7aac253 100644
--- a/TestApplications/src/WpfApplication/MainWindow.xaml.cs
+++ b/TestApplications/src/WpfApplication/MainWindow.xaml.cs
@@ -1,5 +1,7 @@
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Input;
+using System.Collections.Generic;
namespace WpfApplication
{
@@ -8,6 +10,10 @@ namespace WpfApplication
///
public partial class MainWindow
{
+ private List _keysUp = new List();
+ private List _keysDown = new List();
+
+
public MainWindow()
{
InitializeComponent();
@@ -41,5 +47,62 @@ private void OnShowLabel(object sender, RoutedEventArgs e)
lblMenuChk.Visibility = Visibility.Hidden;
}
}
+
+ private void OnKeyDown(object sender, KeyEventArgs e)
+ {
+ AddKey(_keysDown, e.Key);
+ lblKeyboardKeyDown.Content = GenerateKeyboardOutput(_keysDown);
+ }
+
+ private void OnKeyUp(object sender, KeyEventArgs e)
+ {
+ AddKey(_keysUp, e.Key);
+ lblKeyboardKeyUp.Content = GenerateKeyboardOutput(_keysUp);
+ RemoveKey(e.Key);
+ }
+
+ private static void AddKey(ICollection keys, Key key)
+ {
+ if (!keys.Contains(key))
+ {
+ keys.Add(key);
+ }
+ }
+
+ private void RemoveKey(Key key)
+ {
+ _keysDown.Remove(key);
+ if (_keysDown.Count == 0)
+ {
+ _keysUp.Clear();
+ }
+ }
+
+ private static string GenerateKeyboardOutput(IReadOnlyList keys)
+ {
+ var output = "";
+
+ for (var i = 0; i < keys.Count; i++)
+ {
+ if (i == keys.Count - 1)
+ {
+ output += keys[i];
+ }
+ else
+ {
+ output += keys[i] + "+";
+ }
+ }
+
+ return output;
+ }
+
+ private void ResetKeyboard_Click(object sender, RoutedEventArgs e)
+ {
+ _keysDown.Clear();
+ _keysUp.Clear();
+ lblKeyboardKeyDown.Content = GenerateKeyboardOutput(_keysDown);
+ lblKeyboardKeyUp.Content = GenerateKeyboardOutput(_keysUp);
+ }
}
}
diff --git a/TestApplications/src/WpfApplication/Properties/Resources.Designer.cs b/TestApplications/src/WpfApplication/Properties/Resources.Designer.cs
index 91ec701..1c251eb 100644
--- a/TestApplications/src/WpfApplication/Properties/Resources.Designer.cs
+++ b/TestApplications/src/WpfApplication/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace WpfApplication.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/TestApplications/src/WpfApplication/Properties/Settings.Designer.cs b/TestApplications/src/WpfApplication/Properties/Settings.Designer.cs
index 797150a..16a07b1 100644
--- a/TestApplications/src/WpfApplication/Properties/Settings.Designer.cs
+++ b/TestApplications/src/WpfApplication/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace WpfApplication.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/TestApplications/src/WpfApplication/WpfApplication.csproj b/TestApplications/src/WpfApplication/WpfApplication.csproj
index 0e91064..849eca4 100644
--- a/TestApplications/src/WpfApplication/WpfApplication.csproj
+++ b/TestApplications/src/WpfApplication/WpfApplication.csproj
@@ -9,7 +9,7 @@
Properties
WpfApplication
WpfApplication
- v4.5
+ v4.8
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4
diff --git a/atests/Keyboard.robot b/atests/Keyboard.robot
index 6865ab6..832a655 100644
--- a/atests/Keyboard.robot
+++ b/atests/Keyboard.robot
@@ -22,12 +22,15 @@ Resource util/Common.robot
Resource util/Error.robot
Resource util/XPath.robot
-Suite Setup Init Main Application
+Suite Setup Run Keywords Init Main Application
+... AND Open Keyboard Tab
Suite Teardown Stop Application ${MAIN_PID}
-Test Teardown Reset Textbox
+Test Setup Wait Until Keyword Succeeds 5x 10ms Reset Textbox
*** Variables ***
-${XPATH_COMBO_BOX_INPUT} ${MAIN_WINDOW_SIMPLE_CONTROLS}/ComboBox[@AutomationId='EditableCombo']
+${XPATH_INPUT_FIELD} ${MAIN_WINDOW_KEYBOARD_CONTROLS}/Edit[@AutomationId='KeyboardInputField']
+${XPATH_RESET} ${MAIN_WINDOW_KEYBOARD_CONTROLS}/Button[@AutomationId='ResetKeyboardInputs']
+${XPATH_LABEL_INPUT_UP} ${MAIN_WINDOW_KEYBOARD_CONTROLS}/Text[@AutomationId='lblKeyboardKeyDown']
${EXP_VALUE_INPUT_TEXT} = Type text
${EXP_VALUE_OVERRIDE_INPUT_TEXT} = Override
@@ -48,86 +51,89 @@ ${KEYBOARD_INPUT_PASTE} s'CTRL+V'
*** Test Cases ***
Keyboard Type Text
- Press Key ${KEYBOARD_INPUT_TEXT} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Key ${KEYBOARD_INPUT_TEXT} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
-
+
Keyboard Type Text Multiple
- Press Keys ${KEYBOARD_INPUT_TEXT_X2} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_TEXT_X2} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT_SHORTCUT} ${TEXT}
Keyboard Type Shortcut Select All
- Press Keys ${KEYBOARD_INPUT_TEXT_ARRAY} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_TEXT_ARRAY} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
- Press Keys ${KEYBOARD_INPUT_OVERRIDE_TEXT} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_OVERRIDE_TEXT} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_OVERRIDE_INPUT_TEXT} ${TEXT}
Keyboard Type Shortcut Cut and Paste Multiple
- Press Keys ${KEYBOARD_INPUT_TEXT_ARRAY} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_TEXT_ARRAY} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
- Press Keys ${KEYBOARD_INPUT_OVERRIDE_TEXT} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_OVERRIDE_TEXT} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_OVERRIDE_INPUT_TEXT} ${TEXT}
Press Keys ${KEYBOARD_INPUT_SELECT_CUT_TEXT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EMPTY} ${TEXT}
- Press Keys ${KEYBOARD_INPUT_PASTE_ARRAY} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_PASTE_ARRAY} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_OVERRIDE_INPUT_TEXT} ${TEXT}
Keyboard Type Shortcut Copy and Paste Multiple
- Press Keys ${KEYBOARD_INPUT_TEXT_ARRAY} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_TEXT_ARRAY} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
- Press Keys ${KEYBOARD_INPUT_COPY_PASTE_TEXT} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_COPY_PASTE_TEXT} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
- Press Keys ${KEYBOARD_INPUT_PASTE_ARRAY} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_PASTE_ARRAY} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
Keyboard Type Shortcut Copy and Paste
- Press Key ${KEYBOARD_INPUT_TEXT} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Key ${KEYBOARD_INPUT_TEXT} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
- Press Key ${KEYBOARD_INPUT_SELECTALL} ${XPATH_COMBO_BOX_INPUT}
- Press Key ${KEYBOARD_INPUT_COPY} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Key ${KEYBOARD_INPUT_SELECTALL} ${XPATH_INPUT_FIELD}
+ Press Key ${KEYBOARD_INPUT_COPY} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
- Press Key ${KEYBOARD_INPUT_PASTE} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Key ${KEYBOARD_INPUT_PASTE} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT} ${TEXT}
Keyboard Type Generic Key Combination
- Press Keys ${KEYBOARD_INPUT_TEXT_SHORTCUT} ${XPATH_COMBO_BOX_INPUT}
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ Press Keys ${KEYBOARD_INPUT_TEXT_SHORTCUT} ${XPATH_INPUT_FIELD}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${EXP_VALUE_INPUT_TEXT_SHORTCUT} ${TEXT}
Delete Text
${LENGTH} Get Length ${EXP_VALUE_INPUT_TEXT_SHORTCUT}
FOR ${i} IN RANGE 0 ${LENGTH}
- Press Key ${KEYBOARD_INPUT_BACKSPACE} ${XPATH_COMBO_BOX_INPUT}
+ Press Key ${KEYBOARD_INPUT_BACKSPACE} ${XPATH_INPUT_FIELD}
END
- ${TEXT} Get Text From Textbox ${XPATH_COMBO_BOX_INPUT}
+ ${TEXT} Get Text From Textbox ${XPATH_INPUT_FIELD}
Should Be Equal ${TEXT} ${EMPTY}
False Argument Type
- Run Keyword and Expect Error ${EXP_ERR_MSG_ARGUMENT_ARRAY} Press Keys ${KEYBOARD_INPUT_TEXT} ${XPATH_COMBO_BOX_INPUT}
+ Run Keyword and Expect Error ${EXP_ERR_MSG_ARGUMENT_ARRAY} Press Keys ${KEYBOARD_INPUT_TEXT} ${XPATH_INPUT_FIELD}
${EXP_ERR_MSG} Format String ${EXP_INVALID_KEYBOARD_COMBINATION} ${KEYBOARD_INPUT_TEXT_ARRAY}
- ${ERR_MSG} Run Keyword and Expect Error * Press Key ${KEYBOARD_INPUT_TEXT_ARRAY} ${XPATH_COMBO_BOX_INPUT}
+ ${ERR_MSG} Run Keyword and Expect Error * Press Key ${KEYBOARD_INPUT_TEXT_ARRAY} ${XPATH_INPUT_FIELD}
Should Be Equal As Strings ${EXP_ERR_MSG} ${ERR_MSG}
-
+
*** Keywords ***
Reset Textbox
- Set Text To Textbox ${XPATH_COMBO_BOX_INPUT} ${EMPTY}
\ No newline at end of file
+ Click ${XPATH_RESET}
+ ${TEXT} Get Name From Element ${XPATH_LABEL_INPUT_UP}
+ Should Be Empty ${TEXT}
+ Set Text To Textbox ${XPATH_INPUT_FIELD} ${EMPTY}
diff --git a/atests/apps/WpfApplication.exe b/atests/apps/WpfApplication.exe
index ce28c91..6a2e6c5 100644
Binary files a/atests/apps/WpfApplication.exe and b/atests/apps/WpfApplication.exe differ
diff --git a/atests/util/Common.robot b/atests/util/Common.robot
index 27a6546..c422b9f 100644
--- a/atests/util/Common.robot
+++ b/atests/util/Common.robot
@@ -34,3 +34,8 @@ Open Complex Tab
${XPATH_TAB} Set Variable ${MAIN_WINDOW}/Tab
${TAB_ITEM_LIST_CONTROLS} Set Variable Complex Controls
Select Tab Item By Name ${XPATH_TAB} ${TAB_ITEM_LIST_CONTROLS}
+
+Open Keyboard Tab
+ ${XPATH_TAB} Set Variable ${MAIN_WINDOW}/Tab
+ ${TAB_ITEM_LIST_CONTROLS} Set Variable Keyboard Controls
+ Select Tab Item By Name ${XPATH_TAB} ${TAB_ITEM_LIST_CONTROLS}
diff --git a/atests/util/XPath.robot b/atests/util/XPath.robot
index c1b1d0c..65346f5 100644
--- a/atests/util/XPath.robot
+++ b/atests/util/XPath.robot
@@ -5,3 +5,4 @@ ${MAIN_WINDOW_NOTIFIER} /Window[@AutomationId='Notifi
${XPATH_NOT_EXISTS} /NotExists
${MAIN_WINDOW_SIMPLE_CONTROLS} ${MAIN_WINDOW}/Tab/TabItem[@Name='Simple Controls']
${MAIN_WINDOW_COMPLEX_CONTROLS} ${MAIN_WINDOW}/Tab/TabItem[@Name='Complex Controls']
+${MAIN_WINDOW_KEYBOARD_CONTROLS} ${MAIN_WINDOW}/Tab/TabItem[@Name='Keyboard Controls']
diff --git a/src/FlaUILibrary/keywords/keyboard.py b/src/FlaUILibrary/keywords/keyboard.py
index 3998f63..966a369 100644
--- a/src/FlaUILibrary/keywords/keyboard.py
+++ b/src/FlaUILibrary/keywords/keyboard.py
@@ -20,8 +20,6 @@ def __init__(self, module: UIA):
def press_key(self, key_combination, identifier=None, msg=None):
"""
Keyboard control to execute a user defined one shurcut or text.
- If identifier set try to attach to given element if
- operation was successfully old element will be reattached automatically.
Arguments:
| Argument | Type | Description |