Skip to content

Commit 027b77a

Browse files
quangntzelonght
authored andcommitted
* Allow switching process name to realProcessName for an apps starting
with a launcher. That can fix exception Process Not Found in close/quit function. * Fix error when get some attributes.
1 parent 31fdffd commit 027b77a

File tree

3 files changed

+64
-31
lines changed

3 files changed

+64
-31
lines changed

CHANGELOG.md

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
1-
# Change Log
2-
3-
<!--## Unreleased
4-
- Support GetCurrentWindowHandle and GetWindowHandles
5-
- Add driver option --silent to disable logging
6-
-->
7-
8-
## v1.5.0
9-
1+
# Change Log
2+
3+
<!--## Unreleased
4+
- Support GetCurrentWindowHandle and GetWindowHandles
5+
- Add driver option --silent to disable logging
6+
-->
7+
8+
9+
## v1.6.0
10+
11+
- Allow switching process name to `realProcessName` for an apps starting
12+
with a launcher. That can fix exception Process Not Found in close/quit function
13+
- Fix throw exceptions in getting some gui element's attributes
14+
15+
16+
## v1.5.0
17+
1018
- Add `SwitchToWindow` command
11-
- Fix XPath attribute value if this ControlType
12-
13-
14-
## v1.4.0
15-
19+
- Fix XPath attribute value if this ControlType
20+
21+
22+
## v1.4.0
23+
1624
- Add `XPath` strategy for locating elements
1725
- Add `GetCurrentWindowHandle` command
1826
- Add `GetWindowHandles` command
1927
- Add `--silent` option to a driver CLI (suppresses output)
20-
- Fix logger timestamp format
21-
22-
23-
## v1.3.0
24-
28+
- Fix logger timestamp format
29+
30+
31+
## v1.3.0
32+
2533
- Fix error response format
2634
- Add `args` capability for launching application with arguments
2735
- Set default elements search timeout to 10 seconds (fixed in [Winium.Cruciatus 2.7.0](https://github.com/2gis/Winium.Cruciatus/releases/tag/v2.7.0))
@@ -30,14 +38,14 @@
3038
- ComboBox (collapse, expand, is expanded, find selected item, scroll to item)
3139
- DataGrid (row count, column count, find cell, scroll to cell, select cell)
3240
- ListBox (scroll to item)
33-
- Menu (find item, select item)
34-
35-
36-
## v1.2.0
37-
38-
New features:
39-
- Support Action Chains from bindings
40-
- Add new script command for setting value to element using ValuePattern
41-
42-
43-
41+
- Menu (find item, select item)
42+
43+
44+
## v1.2.0
45+
46+
New features:
47+
- Support Action Chains from bindings
48+
- Add new script command for setting value to element using ValuePattern
49+
50+
51+

src/Winium.Desktop.Driver/CommandExecutors/GetElementAttributeExecutor.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ protected override string DoImpl()
3939
* string, bool, int - should be as plain text
4040
* System.Windows.Automation.ControlType - should be used `ProgrammaticName` property
4141
* System.Window.Rect, System.Window.Point - overrides `ToString()` method, can serialize
42+
* Int32[] array - use `string.Join()` method, can serialize
43+
* enum - use `ToString()` method, can serialize
4244
*/
4345
private static object PrepareValueToSerialize(object obj)
4446
{
@@ -58,6 +60,18 @@ private static object PrepareValueToSerialize(object obj)
5860
return controlType.ProgrammaticName;
5961
}
6062

63+
var intArray = obj as Int32[];
64+
if (intArray != null)
65+
{
66+
return string.Join(",", intArray);
67+
}
68+
69+
var intValue = obj as Enum;
70+
if (intValue != null)
71+
{
72+
return intValue.ToString();
73+
}
74+
6175
return obj;
6276
}
6377

src/Winium.Desktop.Driver/CommandExecutors/NewSessionExecutor.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,18 @@ protected override string DoImpl()
3131

3232
// Gives sometime to load visuals (needed only in case of slow emulation)
3333
Thread.Sleep(this.Automator.ActualCapabilities.LaunchDelay);
34-
34+
35+
// Update running application process pointing to the real process instead of the launcher in such cases
36+
if (this.Automator.Application.HasExited())
37+
{
38+
// Add parse process name pass from request
39+
var realProcessName = this.ExecutedCommand.Parameters["desiredCapabilities"]["realProcessName"];
40+
// Update launched process by process name if it's exited
41+
if (realProcessName != null)
42+
{
43+
this.Automator.Application.UpdateProcessByName(realProcessName.ToString());
44+
}
45+
}
3546
return this.JsonResponse(ResponseStatus.Success, this.Automator.ActualCapabilities);
3647
}
3748

0 commit comments

Comments
 (0)