uia 0.0.5.1 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +17 -2
- data/Gemfile +1 -0
- data/Rakefile +13 -0
- data/ext/UiaDll/UIA.Helper/{AutomationProperty.cs → AutomationPropertyCondition.cs} +1 -1
- data/ext/UiaDll/UIA.Helper/Element.cs +46 -6
- data/ext/UiaDll/UIA.Helper/Extensions.cs +13 -0
- data/ext/UiaDll/UIA.Helper/UIA.Helper.csproj +1 -1
- data/ext/UiaDll/UiaDll.Test/ElementInformationTest.cpp +20 -4
- data/ext/UiaDll/UiaDll.Test/ElementStub.h +16 -2
- data/ext/UiaDll/UiaDll.Test/PatternInformationTest.cpp +35 -0
- data/ext/UiaDll/UiaDll.Test/UiaDll.Test.vcxproj +6 -4
- data/ext/UiaDll/UiaDll.Test/UiaDll.Test.vcxproj.filters +3 -0
- data/ext/UiaDll/UiaDll/ElementMethods.cpp +62 -17
- data/ext/UiaDll/UiaDll/ElementStructures.h +19 -9
- data/ext/UiaDll/UiaDll/ExpandCollapseMethods.cpp +33 -0
- data/ext/UiaDll/UiaDll/InvokePatternMethods.cpp +11 -0
- data/ext/UiaDll/UiaDll/PatternInformationStructures.h +90 -0
- data/ext/UiaDll/UiaDll/SelectionItemMethods.cpp +40 -0
- data/ext/UiaDll/UiaDll/SelectionMethods.cpp +16 -0
- data/ext/UiaDll/UiaDll/Stdafx.h +3 -0
- data/ext/UiaDll/UiaDll/ToggleMethods.cpp +25 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +9 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +24 -0
- data/ext/UiaDll/UiaDll/ValuePatternMethods.cpp +25 -0
- data/lib/uia.rb +14 -6
- data/lib/uia/element.rb +35 -11
- data/lib/uia/finder.rb +33 -0
- data/lib/uia/library.rb +48 -6
- data/lib/uia/library/element_attributes.rb +11 -0
- data/lib/uia/library/structs.rb +93 -5
- data/lib/uia/patterns/expand_collapse.rb +17 -0
- data/lib/uia/patterns/invoke.rb +9 -0
- data/lib/uia/patterns/selection.rb +17 -0
- data/lib/uia/patterns/selection_item.rb +25 -0
- data/lib/uia/patterns/toggle.rb +17 -0
- data/lib/uia/patterns/value.rb +22 -0
- data/lib/uia/version.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- data/spec/uia/element_spec.rb +35 -8
- data/spec/uia/patterns/expand_collapse_spec.rb +24 -0
- data/spec/uia/patterns/invoke_spec.rb +15 -0
- data/spec/uia/patterns/selection_item_spec.rb +55 -0
- data/spec/uia/patterns/selection_spec.rb +30 -0
- data/spec/uia/patterns/toggle_spec.rb +41 -0
- data/spec/uia/patterns/value_spec.rb +16 -0
- data/spec/uia_spec.rb +26 -7
- metadata +37 -4
data/ChangeLog
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
-
===
|
1
|
+
=== Version 0.0.6 / 2013-10-22
|
2
|
+
* Enhancements
|
3
|
+
* Have implemented the following patterns:
|
4
|
+
* ExpandCollapse
|
5
|
+
* Invoke
|
6
|
+
* Selection
|
7
|
+
* SelectionItem
|
8
|
+
* Toggle
|
9
|
+
* Value
|
10
|
+
* Element can find their descendants by :id or :name
|
11
|
+
* Can search for top-level elements with Regex
|
12
|
+
* Elements can be refreshed
|
13
|
+
* Moved Uia methods to be class-level (i.e. Uia.find_element rather than
|
14
|
+
including Uia)
|
15
|
+
|
16
|
+
=== Version 0.0.5.1 / 2013-10-16
|
2
17
|
* Enhancements
|
3
18
|
* reduced the size of the gem package by excluding gmock and gtest
|
4
19
|
|
5
|
-
=== Version 0.0.5 /
|
20
|
+
=== Version 0.0.5 / 2013-10-16
|
6
21
|
|
7
22
|
* Enhancements
|
8
23
|
* Pushed #find_element into the Uia module
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
+
require 'bundler/setup'
|
1
2
|
require 'bundler/gem_tasks'
|
2
3
|
require 'rspec/core/rake_task'
|
3
4
|
|
5
|
+
require 'albacore'
|
6
|
+
require 'albacore/tasks/versionizer'
|
7
|
+
|
4
8
|
RSpec::Core::RakeTask.new(:spec)
|
5
9
|
|
6
10
|
task :default => :spec
|
11
|
+
|
12
|
+
task :spec => :build_release
|
13
|
+
task :build => :spec
|
14
|
+
|
15
|
+
desc 'Build the release version of UiaDll'
|
16
|
+
build :build_release do |b|
|
17
|
+
b.sln = 'ext/UiaDll/UiaDll.sln'
|
18
|
+
b.prop :Configuration, :Release
|
19
|
+
end
|
@@ -17,6 +17,11 @@ namespace UIA.Helper
|
|
17
17
|
_element = element;
|
18
18
|
}
|
19
19
|
|
20
|
+
public TPattern As<TPattern>(AutomationPattern pattern)
|
21
|
+
{
|
22
|
+
return (TPattern) _element.GetCurrentPattern(pattern);
|
23
|
+
}
|
24
|
+
|
20
25
|
public virtual int[] RuntimeId
|
21
26
|
{
|
22
27
|
get { return _element.GetRuntimeId(); }
|
@@ -27,11 +32,21 @@ namespace UIA.Helper
|
|
27
32
|
get { return _element.Current.Name; }
|
28
33
|
}
|
29
34
|
|
35
|
+
public virtual string ClassName
|
36
|
+
{
|
37
|
+
get { return _element.Current.ClassName; }
|
38
|
+
}
|
39
|
+
|
30
40
|
public virtual string Id
|
31
41
|
{
|
32
42
|
get { return _element.Current.AutomationId; }
|
33
43
|
}
|
34
44
|
|
45
|
+
public virtual bool IsEnabled
|
46
|
+
{
|
47
|
+
get { return _element.Current.IsEnabled; }
|
48
|
+
}
|
49
|
+
|
35
50
|
public virtual int NativeWindowHandle
|
36
51
|
{
|
37
52
|
get { return _element.Current.NativeWindowHandle; }
|
@@ -52,9 +67,9 @@ namespace UIA.Helper
|
|
52
67
|
get { return Find(TreeScope.Children, Condition.TrueCondition); }
|
53
68
|
}
|
54
69
|
|
55
|
-
public Element[] ChildrenOf(
|
70
|
+
public Element[] ChildrenOf(AutomationPropertyCondition.Id id)
|
56
71
|
{
|
57
|
-
return Find(TreeScope.Children,
|
72
|
+
return Find(TreeScope.Children, AutomationPropertyCondition.From(id));
|
58
73
|
}
|
59
74
|
|
60
75
|
public Element[] Descendants
|
@@ -67,9 +82,29 @@ namespace UIA.Helper
|
|
67
82
|
Clicker.MouseClick(_element);
|
68
83
|
}
|
69
84
|
|
85
|
+
public static Element From(AutomationElement element)
|
86
|
+
{
|
87
|
+
return new Element(element);
|
88
|
+
}
|
89
|
+
|
70
90
|
public static Element ById(string automationId)
|
71
91
|
{
|
72
|
-
return FindFirst(
|
92
|
+
return FindFirst(automationId.IdCondition());
|
93
|
+
}
|
94
|
+
|
95
|
+
public Element ChildById(string automationId)
|
96
|
+
{
|
97
|
+
return FindFirst(TreeScope.Descendants, automationId.IdCondition());
|
98
|
+
}
|
99
|
+
|
100
|
+
public static Element ByName(string name)
|
101
|
+
{
|
102
|
+
return FindFirst(new PropertyCondition(AutomationElement.NameProperty, name));
|
103
|
+
}
|
104
|
+
|
105
|
+
public Element ChildByName(string name)
|
106
|
+
{
|
107
|
+
return FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, name));
|
73
108
|
}
|
74
109
|
|
75
110
|
public static Element ByProcessId(int processId)
|
@@ -84,7 +119,7 @@ namespace UIA.Helper
|
|
84
119
|
|
85
120
|
public static Element ByRuntimeId(int[] runtimeId)
|
86
121
|
{
|
87
|
-
return FindFirst(new PropertyCondition(AutomationElement.RuntimeIdProperty, runtimeId));
|
122
|
+
return FindFirst(new PropertyCondition(AutomationElement.RuntimeIdProperty, runtimeId), TreeScope.Descendants);
|
88
123
|
}
|
89
124
|
|
90
125
|
private Element[] Find(TreeScope scope, Condition condition)
|
@@ -94,9 +129,14 @@ namespace UIA.Helper
|
|
94
129
|
.ToArray();
|
95
130
|
}
|
96
131
|
|
97
|
-
private
|
132
|
+
private Element FindFirst(TreeScope scope, Condition condition)
|
133
|
+
{
|
134
|
+
return NullOr(_element.FindFirst(scope, condition));
|
135
|
+
}
|
136
|
+
|
137
|
+
private static Element FindFirst(Condition condition, TreeScope scope = TreeScope.Children)
|
98
138
|
{
|
99
|
-
return NullOr(AutomationElement.RootElement.FindFirst(
|
139
|
+
return NullOr(AutomationElement.RootElement.FindFirst(scope, condition));
|
100
140
|
}
|
101
141
|
|
102
142
|
private static Element NullOr(AutomationElement automationElement)
|
@@ -15,6 +15,19 @@ namespace UIA.Helper
|
|
15
15
|
}
|
16
16
|
}
|
17
17
|
|
18
|
+
public static class PropertyExtensions
|
19
|
+
{
|
20
|
+
public static Condition IdCondition(this string automationId)
|
21
|
+
{
|
22
|
+
return new PropertyCondition(AutomationElement.AutomationIdProperty, automationId);
|
23
|
+
}
|
24
|
+
|
25
|
+
public static Condition NameCondition(this string name)
|
26
|
+
{
|
27
|
+
return new PropertyCondition(AutomationElement.NameProperty, name);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
18
31
|
public static class ElementExtensions
|
19
32
|
{
|
20
33
|
|
@@ -45,7 +45,7 @@
|
|
45
45
|
<Reference Include="WindowsBase" />
|
46
46
|
</ItemGroup>
|
47
47
|
<ItemGroup>
|
48
|
-
<Compile Include="
|
48
|
+
<Compile Include="AutomationPropertyCondition.cs" />
|
49
49
|
<Compile Include="Clicker.cs" />
|
50
50
|
<Compile Include="Element.cs" />
|
51
51
|
<Compile Include="Extensions.cs" />
|
@@ -63,6 +63,14 @@ TEST_F(ElementInformationTest, ItKnowsTheControlType)
|
|
63
63
|
ASSERT_EQ(1234, ElementInformation(element).controlTypeId);
|
64
64
|
}
|
65
65
|
|
66
|
+
TEST_F(ElementInformationTest, ItKnowsTheClassName)
|
67
|
+
{
|
68
|
+
auto element = gcnew ElementStub("");
|
69
|
+
element->ClassName = "Expected class name";
|
70
|
+
|
71
|
+
ASSERT_STREQ("Expected class name", ElementInformation(element).className);
|
72
|
+
}
|
73
|
+
|
66
74
|
TEST_F(ElementInformationTest, ItKnowsTheSupportedPatterns)
|
67
75
|
{
|
68
76
|
auto element = gcnew ElementStub("");
|
@@ -74,16 +82,24 @@ TEST_F(ElementInformationTest, ItKnowsTheSupportedPatterns)
|
|
74
82
|
ASSERT_THAT(expectedPatterns, ::testing::ElementsAreArray(elementInformation.patterns, elementInformation.patternsLength));
|
75
83
|
}
|
76
84
|
|
77
|
-
TEST_F(ElementInformationTest,
|
85
|
+
TEST_F(ElementInformationTest, ItKnowIfItIsEnabled)
|
86
|
+
{
|
87
|
+
auto element = gcnew ElementStub("");
|
88
|
+
element->IsEnabled = true;
|
89
|
+
|
90
|
+
ASSERT_EQ(true, ElementInformation(element).isEnabled);
|
91
|
+
}
|
92
|
+
|
93
|
+
TEST_F(ElementInformationTest, ItCanBeRefreshed)
|
78
94
|
{
|
79
95
|
auto elementInformation = ElementInformation(gcnew ElementStub("Initial", 0));
|
80
96
|
|
81
|
-
auto updatedElement = gcnew ElementStub("
|
97
|
+
auto updatedElement = gcnew ElementStub("Refreshed", 46, 2);
|
82
98
|
updatedElement->NativeWindowHandle = 123;
|
83
|
-
elementInformation.
|
99
|
+
elementInformation.Refresh(updatedElement);
|
84
100
|
|
85
101
|
const int expectedId[] = {46, 2};
|
86
102
|
ASSERT_THAT(expectedId, ::testing::ElementsAreArray(elementInformation.runtimeId, elementInformation.runtimeIdLength));
|
87
|
-
ASSERT_STREQ("
|
103
|
+
ASSERT_STREQ("Refreshed", elementInformation.name);
|
88
104
|
ASSERT_EQ(123, elementInformation.nativeWindowHandle);
|
89
105
|
}
|
@@ -16,10 +16,22 @@ public:
|
|
16
16
|
void set(String^ name) { _name = name; }
|
17
17
|
}
|
18
18
|
|
19
|
+
virtual property String^ ClassName
|
20
|
+
{
|
21
|
+
String^ get() override { return _className; }
|
22
|
+
void set(String^ className) { _className = className; }
|
23
|
+
}
|
24
|
+
|
19
25
|
virtual property String^ Id
|
20
26
|
{
|
21
27
|
String^ get() override { return _id; }
|
22
|
-
void set(String^ value)
|
28
|
+
void set(String^ value) { _id = value; }
|
29
|
+
}
|
30
|
+
|
31
|
+
virtual property bool IsEnabled
|
32
|
+
{
|
33
|
+
bool get() override { return _isEnabled; }
|
34
|
+
void set(bool value) { _isEnabled = value; }
|
23
35
|
}
|
24
36
|
|
25
37
|
virtual property array<int>^ RuntimeId
|
@@ -36,7 +48,7 @@ public:
|
|
36
48
|
virtual property int ControlTypeId
|
37
49
|
{
|
38
50
|
int get() override { return _controlTypeId; }
|
39
|
-
void set(int value)
|
51
|
+
void set(int value) { _controlTypeId = value; }
|
40
52
|
}
|
41
53
|
|
42
54
|
virtual property array<int>^ SupportedPatternIds
|
@@ -51,9 +63,11 @@ public:
|
|
51
63
|
|
52
64
|
private:
|
53
65
|
String^ _name;
|
66
|
+
String^ _className;
|
54
67
|
String^ _id;
|
55
68
|
array<int>^ _runtimeIds;
|
56
69
|
array<int>^ _patterns;
|
57
70
|
int _nativeWindowHandle;
|
58
71
|
int _controlTypeId;
|
72
|
+
bool _isEnabled;
|
59
73
|
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#include "stdafx.h"
|
2
|
+
|
3
|
+
#include <PatternInformationStructures.h>
|
4
|
+
#include "ElementStub.h"
|
5
|
+
|
6
|
+
TEST(ValueInformation, CanBeInitialized)
|
7
|
+
{
|
8
|
+
auto valueInfo = new ValuePatternInformation("Whatever", true);
|
9
|
+
ASSERT_STREQ("Whatever", valueInfo->Value);
|
10
|
+
ASSERT_EQ(true, valueInfo->IsReadOnly);
|
11
|
+
delete valueInfo;
|
12
|
+
}
|
13
|
+
|
14
|
+
TEST(ToggleInformation, CanBeInitialized)
|
15
|
+
{
|
16
|
+
auto toggleInfo = new ToggleInformation("On");
|
17
|
+
ASSERT_STREQ("On", toggleInfo->ToggleState);
|
18
|
+
delete toggleInfo;
|
19
|
+
}
|
20
|
+
|
21
|
+
TEST(SelectionItemInformation, CanBeInitialized)
|
22
|
+
{
|
23
|
+
auto isSelected = true;
|
24
|
+
auto container = gcnew ElementStub("Expected container");
|
25
|
+
|
26
|
+
auto selectionItemInfo = SelectionItemInformation(isSelected, container);
|
27
|
+
|
28
|
+
ASSERT_STREQ("Expected container", selectionItemInfo.Container->name);
|
29
|
+
ASSERT_EQ(true, selectionItemInfo.IsSelected);
|
30
|
+
}
|
31
|
+
|
32
|
+
TEST(ExpandCollapseInfo, CanBeInitialized) {
|
33
|
+
auto expandCollapseInfo = ExpandCollapseInfo("Collapsed");
|
34
|
+
ASSERT_STREQ("Collapsed", expandCollapseInfo.ExpandCollapseState);
|
35
|
+
}
|
@@ -53,13 +53,13 @@
|
|
53
53
|
<Optimization>Disabled</Optimization>
|
54
54
|
<PreprocessorDefinitions>WIN32;_VARIADIC_MAX=10;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
55
55
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
56
|
-
<AdditionalIncludeDirectories>C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\gmock\include;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\gtest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
56
|
+
<AdditionalIncludeDirectories>C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\vendor\gmock\include;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\vendor\gtest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
57
57
|
</ClCompile>
|
58
58
|
<Link>
|
59
59
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
60
60
|
<AdditionalDependencies>gtestd.lib;gmockd.lib</AdditionalDependencies>
|
61
61
|
<SubSystem>Console</SubSystem>
|
62
|
-
<AdditionalLibraryDirectories>C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\gmock\lib;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\gtest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
62
|
+
<AdditionalLibraryDirectories>C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\vendor\gmock\lib;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\vendor\gtest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
63
63
|
</Link>
|
64
64
|
<PostBuildEvent>
|
65
65
|
<Command>$(TargetPath)</Command>
|
@@ -70,13 +70,13 @@
|
|
70
70
|
<WarningLevel>Level3</WarningLevel>
|
71
71
|
<PreprocessorDefinitions>WIN32;_VARIADIC_MAX=10;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
72
72
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
73
|
-
<AdditionalIncludeDirectories>C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\gmock\include;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\gtest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
73
|
+
<AdditionalIncludeDirectories>C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\vendor\gmock\include;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\vendor\gtest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
74
74
|
</ClCompile>
|
75
75
|
<Link>
|
76
76
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
77
77
|
<AdditionalDependencies>gtest.lib;gmock.lib</AdditionalDependencies>
|
78
78
|
<SubSystem>Console</SubSystem>
|
79
|
-
<AdditionalLibraryDirectories>C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\gmock\lib;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\gtest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
79
|
+
<AdditionalLibraryDirectories>C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\vendor\gmock\lib;C:\Users\Levi\git\northwoods\uia\ext\UiaDll\UiaDll.Test\vendor\gtest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
80
80
|
</Link>
|
81
81
|
<PostBuildEvent>
|
82
82
|
<Command>$(TargetPath)</Command>
|
@@ -86,6 +86,7 @@
|
|
86
86
|
<Reference Include="System" />
|
87
87
|
<Reference Include="System.Data" />
|
88
88
|
<Reference Include="System.Xml" />
|
89
|
+
<Reference Include="UIAutomationClient" />
|
89
90
|
</ItemGroup>
|
90
91
|
<ItemGroup>
|
91
92
|
<Text Include="ReadMe.txt" />
|
@@ -103,6 +104,7 @@
|
|
103
104
|
<ClCompile Include="AssemblyInfo.cpp" />
|
104
105
|
<ClCompile Include="ElementInformationTest.cpp" />
|
105
106
|
<ClCompile Include="ElementsTest.cpp" />
|
107
|
+
<ClCompile Include="PatternInformationTest.cpp" />
|
106
108
|
<ClCompile Include="stdafx.cpp">
|
107
109
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
108
110
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
using namespace UIA::Helper;
|
4
4
|
|
5
5
|
extern "C" {
|
6
|
-
Element^ Find(
|
6
|
+
Element^ Find(ElementInformationPtr element) {
|
7
7
|
if( element->nativeWindowHandle > 0 ) {
|
8
8
|
return Element::ByHandle(IntPtr(element->nativeWindowHandle));
|
9
9
|
}
|
@@ -11,17 +11,25 @@ extern "C" {
|
|
11
11
|
return Element::ByRuntimeId(ArrayHelper::ToArray(element->runtimeId, element->runtimeIdLength));
|
12
12
|
}
|
13
13
|
|
14
|
-
__declspec(dllexport) void Element_Release(
|
14
|
+
__declspec(dllexport) void Element_Release(ElementInformationPtr elementInformation) {
|
15
15
|
delete elementInformation;
|
16
16
|
}
|
17
17
|
|
18
|
-
__declspec(dllexport) void Element_ReleaseMany(
|
18
|
+
__declspec(dllexport) void Element_ReleaseMany(ElementsPtr elements) {
|
19
19
|
delete elements;
|
20
20
|
}
|
21
21
|
|
22
|
-
__declspec(dllexport)
|
22
|
+
__declspec(dllexport) void Element_Refresh(ElementInformationPtr element, char* errorInfo, const int errorInfoLength) {
|
23
23
|
try {
|
24
|
-
|
24
|
+
element->Refresh(Find(element));
|
25
|
+
} catch(Exception^ e) {
|
26
|
+
StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
__declspec(dllexport) ElementInformationPtr Element_FindById(const char* automationId, char* errorInfo, const int errorLength) {
|
31
|
+
try {
|
32
|
+
return ElementInformation::From(Element::ById(gcnew String(automationId)));
|
25
33
|
} catch(Exception^ error) {
|
26
34
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
27
35
|
}
|
@@ -29,9 +37,9 @@ extern "C" {
|
|
29
37
|
return NULL;
|
30
38
|
}
|
31
39
|
|
32
|
-
__declspec(dllexport)
|
40
|
+
__declspec(dllexport) ElementInformationPtr Element_FindChildById(ElementInformationPtr parent, const char* automationId, char* errorInfo, const int errorLength) {
|
33
41
|
try {
|
34
|
-
return
|
42
|
+
return ElementInformation::From(Find(parent)->ChildById(gcnew String(automationId)));
|
35
43
|
} catch(Exception^ error) {
|
36
44
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
37
45
|
}
|
@@ -39,9 +47,9 @@ extern "C" {
|
|
39
47
|
return NULL;
|
40
48
|
}
|
41
49
|
|
42
|
-
__declspec(dllexport)
|
50
|
+
__declspec(dllexport) ElementInformationPtr Element_FindByName(const char* name, char* errorInfo, const int errorLength) {
|
43
51
|
try {
|
44
|
-
return
|
52
|
+
return ElementInformation::From(Element::ByName(gcnew String(name)));
|
45
53
|
} catch(Exception^ error) {
|
46
54
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
47
55
|
}
|
@@ -49,39 +57,76 @@ extern "C" {
|
|
49
57
|
return NULL;
|
50
58
|
}
|
51
59
|
|
52
|
-
__declspec(dllexport)
|
60
|
+
__declspec(dllexport) ElementInformationPtr Element_FindChildByName(ElementInformationPtr parent, const char* name, char* errorInfo, const int errorLength) {
|
53
61
|
try {
|
54
|
-
return
|
62
|
+
return ElementInformation::From(Find(parent)->ChildByName(gcnew String(name)));
|
55
63
|
} catch(Exception^ error) {
|
56
64
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
57
65
|
}
|
66
|
+
|
67
|
+
return NULL;
|
58
68
|
}
|
59
69
|
|
60
|
-
__declspec(dllexport)
|
70
|
+
__declspec(dllexport) ElementInformationPtr Element_FindByProcessId(const int processId, char* errorInfo, const int errorLength) {
|
61
71
|
try {
|
62
|
-
return
|
72
|
+
return ElementInformation::From(Element::ByProcessId(processId));
|
73
|
+
} catch(Exception^ error) {
|
74
|
+
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
75
|
+
}
|
76
|
+
|
77
|
+
return NULL;
|
78
|
+
}
|
79
|
+
|
80
|
+
__declspec(dllexport) ElementInformationPtr Element_FindByHandle(HWND windowHandle, char* errorInfo, const int errorLength) {
|
81
|
+
try {
|
82
|
+
return new ElementInformation(Element::ByHandle(IntPtr(windowHandle)));
|
83
|
+
} catch(Exception^ error) {
|
84
|
+
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
85
|
+
}
|
86
|
+
|
87
|
+
return NULL;
|
88
|
+
}
|
89
|
+
|
90
|
+
__declspec(dllexport) ElementInformationPtr Element_FindByRuntimeId(const int runtimeIds[], const int numberOfIds, char* errorInfo, const int errorLength) {
|
91
|
+
try {
|
92
|
+
return ElementInformation::From(Element::ByRuntimeId(ArrayHelper::ToArray(runtimeIds, numberOfIds)));
|
63
93
|
} catch(Exception^ error) {
|
64
94
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
65
95
|
}
|
96
|
+
|
97
|
+
return NULL;
|
98
|
+
}
|
99
|
+
|
100
|
+
__declspec(dllexport) ElementsPtr Root_Children(char* errorInfo, const int errorInfoLength) {
|
101
|
+
try {
|
102
|
+
return new Elements(Element::From(AutomationElement::RootElement)->Children);
|
103
|
+
} catch(Exception^ e) {
|
104
|
+
StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
|
105
|
+
return NULL;
|
106
|
+
}
|
66
107
|
}
|
67
108
|
|
68
|
-
__declspec(dllexport)
|
109
|
+
__declspec(dllexport) ElementsPtr Element_Children(ElementInformationPtr parentElement, char* errorInfo, const int errorLength) {
|
69
110
|
try {
|
70
|
-
return new Elements(Find(
|
111
|
+
return new Elements(Find(parentElement)->Children);
|
71
112
|
} catch(Exception^ error) {
|
72
113
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
73
114
|
}
|
115
|
+
|
116
|
+
return NULL;
|
74
117
|
}
|
75
118
|
|
76
|
-
__declspec(dllexport)
|
119
|
+
__declspec(dllexport) ElementsPtr Element_Descendants(ElementInformationPtr parentElement, char* errorInfo, const int errorLength) {
|
77
120
|
try {
|
78
121
|
return new Elements(Find(parentElement)->Descendants);
|
79
122
|
} catch(Exception^ error) {
|
80
123
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
81
124
|
}
|
125
|
+
|
126
|
+
return NULL;
|
82
127
|
}
|
83
128
|
|
84
|
-
__declspec(dllexport) void Element_Click(
|
129
|
+
__declspec(dllexport) void Element_Click(ElementInformationPtr element, char* errorInfo, const int errorLength) {
|
85
130
|
try {
|
86
131
|
Find(element)->MouseClick();
|
87
132
|
} catch(Exception^ error) {
|