robotframework-platynui 0.0.1__py3-none-any.whl
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.
- PlatynUI/ButtonKeywords.py +9 -0
- PlatynUI/TextKeywords.py +7 -0
- PlatynUI/__about__.py +4 -0
- PlatynUI/__init__.py +34 -0
- PlatynUI/core/__init__.py +13 -0
- PlatynUI/core/adapter.py +152 -0
- PlatynUI/core/adapterfactory.py +51 -0
- PlatynUI/core/adapterproxy.py +168 -0
- PlatynUI/core/contextbase.py +586 -0
- PlatynUI/core/exceptions.py +77 -0
- PlatynUI/core/internal/__init__.py +0 -0
- PlatynUI/core/internal/decorator.py +148 -0
- PlatynUI/core/locatorbase.py +197 -0
- PlatynUI/core/locatorscope.py +17 -0
- PlatynUI/core/predicate.py +15 -0
- PlatynUI/core/settings.py +63 -0
- PlatynUI/core/strategies/__init__.py +1 -0
- PlatynUI/core/strategies/strategies.py +26 -0
- PlatynUI/core/strategybase.py +8 -0
- PlatynUI/core/strategyimpl.py +102 -0
- PlatynUI/core/technology.py +25 -0
- PlatynUI/core/types.py +421 -0
- PlatynUI/core/wait_for.py +47 -0
- PlatynUI/core/weight_calculator.py +110 -0
- PlatynUI/py.typed +0 -0
- PlatynUI/robot/__init__.py +0 -0
- PlatynUI/robot/reporting.py +74 -0
- PlatynUI/technology/__init__.py +0 -0
- PlatynUI/technology/uiautomation/.gitignore +1 -0
- PlatynUI/technology/uiautomation/__init__.py +4 -0
- PlatynUI/technology/uiautomation/core/adapterfactory.py +88 -0
- PlatynUI/technology/uiautomation/core/displaydevice.py +23 -0
- PlatynUI/technology/uiautomation/core/impls/__init__.py +2 -0
- PlatynUI/technology/uiautomation/core/impls/control.py +31 -0
- PlatynUI/technology/uiautomation/core/impls/window.py +83 -0
- PlatynUI/technology/uiautomation/core/keyboarddevice.py +21 -0
- PlatynUI/technology/uiautomation/core/loader.py +117 -0
- PlatynUI/technology/uiautomation/core/mousedevice.py +29 -0
- PlatynUI/technology/uiautomation/core/technology.py +61 -0
- PlatynUI/technology/uiautomation/core/uiaadapter.py +197 -0
- PlatynUI/technology/uiautomation/core/uiabase.py +19 -0
- PlatynUI/technology/uiautomation/desktop.py +11 -0
- PlatynUI/technology/uiautomation/locator.py +435 -0
- PlatynUI/technology/uiautomation/runtime/Caliburn.Micro.Core.dll +0 -0
- PlatynUI/technology/uiautomation/runtime/Caliburn.Micro.Platform.Core.dll +0 -0
- PlatynUI/technology/uiautomation/runtime/Caliburn.Micro.Platform.dll +0 -0
- PlatynUI/technology/uiautomation/runtime/Microsoft.Xaml.Behaviors.dll +0 -0
- PlatynUI/technology/uiautomation/runtime/PlatynUI.Technology.UiAutomation.Spy.deps.json +266 -0
- PlatynUI/technology/uiautomation/runtime/PlatynUI.Technology.UiAutomation.Spy.dll +0 -0
- PlatynUI/technology/uiautomation/runtime/PlatynUI.Technology.UiAutomation.Spy.exe +0 -0
- PlatynUI/technology/uiautomation/runtime/PlatynUI.Technology.UiAutomation.Spy.runtimeconfig.json +19 -0
- PlatynUI/technology/uiautomation/runtime/PlatynUI.Technology.UiAutomation.dll +0 -0
- PlatynUI/technology/uiautomation/runtime/System.ComponentModel.Composition.dll +0 -0
- PlatynUI/technology/uiautomation/spy/__init__.py +0 -0
- PlatynUI/technology/uiautomation/spy/__main__.py +24 -0
- PlatynUI/ui/__init__.py +65 -0
- PlatynUI/ui/application.py +27 -0
- PlatynUI/ui/buttons.py +82 -0
- PlatynUI/ui/combobox.py +149 -0
- PlatynUI/ui/container.py +9 -0
- PlatynUI/ui/control.py +49 -0
- PlatynUI/ui/core/__init__.py +3 -0
- PlatynUI/ui/core/devices/__init__.py +6 -0
- PlatynUI/ui/core/devices/basedisplaydevice.py +25 -0
- PlatynUI/ui/core/devices/basekeyboarddevice.py +64 -0
- PlatynUI/ui/core/devices/basemousedevice.py +30 -0
- PlatynUI/ui/core/devices/basescreendevice.py +16 -0
- PlatynUI/ui/core/devices/displaydevice.py +113 -0
- PlatynUI/ui/core/devices/inputdevice.py +24 -0
- PlatynUI/ui/core/devices/keyboarddevice.py +279 -0
- PlatynUI/ui/core/devices/keyboardproxy.py +69 -0
- PlatynUI/ui/core/devices/mousebutton.py +11 -0
- PlatynUI/ui/core/devices/mousedevice.py +279 -0
- PlatynUI/ui/core/devices/mouseproxy.py +178 -0
- PlatynUI/ui/core/ui_technology.py +31 -0
- PlatynUI/ui/core/window_manager.py +59 -0
- PlatynUI/ui/desktopbase.py +56 -0
- PlatynUI/ui/dialog.py +10 -0
- PlatynUI/ui/edit.py +48 -0
- PlatynUI/ui/element.py +265 -0
- PlatynUI/ui/graphic.py +14 -0
- PlatynUI/ui/header.py +33 -0
- PlatynUI/ui/item.py +100 -0
- PlatynUI/ui/lists.py +37 -0
- PlatynUI/ui/menus.py +42 -0
- PlatynUI/ui/orientation.py +9 -0
- PlatynUI/ui/pane.py +14 -0
- PlatynUI/ui/proxies/__init__.py +4 -0
- PlatynUI/ui/proxies/standardproxies.py +391 -0
- PlatynUI/ui/scrollbar.py +9 -0
- PlatynUI/ui/strategies/__init__.py +19 -0
- PlatynUI/ui/strategies/activatable.py +27 -0
- PlatynUI/ui/strategies/application.py +28 -0
- PlatynUI/ui/strategies/closeable.py +22 -0
- PlatynUI/ui/strategies/control.py +16 -0
- PlatynUI/ui/strategies/editable.py +13 -0
- PlatynUI/ui/strategies/element.py +65 -0
- PlatynUI/ui/strategies/expandable.py +27 -0
- PlatynUI/ui/strategies/hasnativewindowhandle.py +14 -0
- PlatynUI/ui/strategies/hasorientation.py +15 -0
- PlatynUI/ui/strategies/maximizeable.py +27 -0
- PlatynUI/ui/strategies/minimizeable.py +27 -0
- PlatynUI/ui/strategies/movable.py +14 -0
- PlatynUI/ui/strategies/resizable.py +13 -0
- PlatynUI/ui/strategies/restorable.py +13 -0
- PlatynUI/ui/strategies/selectable.py +27 -0
- PlatynUI/ui/strategies/text.py +55 -0
- PlatynUI/ui/strategies/title.py +14 -0
- PlatynUI/ui/strategies/toggleable.py +23 -0
- PlatynUI/ui/strategies/value.py +15 -0
- PlatynUI/ui/table.py +56 -0
- PlatynUI/ui/tabs.py +28 -0
- PlatynUI/ui/text.py +14 -0
- PlatynUI/ui/togglestate.py +12 -0
- PlatynUI/ui/tree.py +99 -0
- PlatynUI/ui/unknown.py +9 -0
- PlatynUI/ui/window.py +177 -0
- robotframework_platynui-0.0.1.dist-info/METADATA +49 -0
- robotframework_platynui-0.0.1.dist-info/RECORD +122 -0
- robotframework_platynui-0.0.1.dist-info/WHEEL +4 -0
- robotframework_platynui-0.0.1.dist-info/entry_points.txt +2 -0
- robotframework_platynui-0.0.1.dist-info/licenses/LICENSE.txt +73 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from abc import abstractmethod
|
|
2
|
+
|
|
3
|
+
from ...core import StrategyBase
|
|
4
|
+
|
|
5
|
+
__all__ = ["HasCanMinimize", "Minimizable"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HasCanMinimize(StrategyBase):
|
|
9
|
+
strategy_name = "org.platynui.strategies.HasCanMinimize"
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def can_minimize(self) -> bool:
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
@abstractmethod
|
|
18
|
+
def is_minimized(self) -> bool:
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Minimizable(StrategyBase):
|
|
23
|
+
strategy_name = "org.platynui.strategies.Minimizable"
|
|
24
|
+
|
|
25
|
+
@abstractmethod
|
|
26
|
+
def minimize(self) -> None:
|
|
27
|
+
pass
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from abc import *
|
|
2
|
+
|
|
3
|
+
from ...core import StrategyBase
|
|
4
|
+
from ...core.types import Point
|
|
5
|
+
|
|
6
|
+
__all__ = ["Movable"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Movable(StrategyBase):
|
|
10
|
+
strategy_name = "org.platynui.strategies.Movable"
|
|
11
|
+
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def move(self, point: Point) -> None:
|
|
14
|
+
pass
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from abc import *
|
|
2
|
+
|
|
3
|
+
from ...core import StrategyBase
|
|
4
|
+
from ...core.types import Size
|
|
5
|
+
|
|
6
|
+
__all__ = ["Resizable"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Resizable(StrategyBase):
|
|
10
|
+
strategy_name = "org.platynui.strategies.Resizable"
|
|
11
|
+
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def resize(self, size: Size) -> None: ...
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from abc import *
|
|
2
|
+
|
|
3
|
+
from ...core import StrategyBase
|
|
4
|
+
|
|
5
|
+
__all__ = ["HasSelected", "Selectable"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HasSelected(StrategyBase):
|
|
9
|
+
strategy_name = "org.platynui.strategies.HasSelected"
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def is_selectable(self) -> bool:
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
@abstractmethod
|
|
18
|
+
def is_selected(self) -> bool:
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Selectable(HasSelected):
|
|
23
|
+
strategy_name = "org.platynui.strategies.Selectable"
|
|
24
|
+
|
|
25
|
+
@abstractmethod
|
|
26
|
+
def select(self):
|
|
27
|
+
pass
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from abc import *
|
|
2
|
+
|
|
3
|
+
from ...core import StrategyBase
|
|
4
|
+
|
|
5
|
+
__all__ = ["Text", "EditableText", "Clearable", "HasEditor", "HasMultiLine"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Text(StrategyBase):
|
|
9
|
+
strategy_name = "org.platynui.strategies.Text"
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def text(self) -> str:
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Clearable(StrategyBase):
|
|
18
|
+
strategy_name = "org.platynui.strategies.Clearable"
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def clear(self) -> None:
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class EditableText(StrategyBase):
|
|
26
|
+
strategy_name = "org.platynui.strategies.EditableText"
|
|
27
|
+
|
|
28
|
+
@abstractmethod
|
|
29
|
+
def set_text(self, value: str) -> None:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class HasEditor(StrategyBase):
|
|
34
|
+
strategy_name = "org.platynui.strategies.HasEditor"
|
|
35
|
+
|
|
36
|
+
@abstractmethod
|
|
37
|
+
def open_editor(self):
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
@abstractmethod
|
|
41
|
+
def cancel(self):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
@abstractmethod
|
|
45
|
+
def accept(self):
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class HasMultiLine(StrategyBase):
|
|
50
|
+
strategy_name = "org.platynui.strategies.HasMultiLine"
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
@abstractmethod
|
|
54
|
+
def is_multi_line(self) -> bool:
|
|
55
|
+
pass
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from abc import *
|
|
2
|
+
|
|
3
|
+
from ...core import StrategyBase
|
|
4
|
+
from ..togglestate import ToggleState
|
|
5
|
+
|
|
6
|
+
__all__ = ["HasToggleState", "Toggleable", "ToggleState"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HasToggleState(StrategyBase):
|
|
10
|
+
strategy_name = "org.platynui.strategies.HasToggleState"
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def state(self) -> ToggleState:
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Toggleable(StrategyBase):
|
|
19
|
+
strategy_name = "org.platynui.strategies.Toggleable"
|
|
20
|
+
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def toggle(self) -> None:
|
|
23
|
+
pass
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from abc import abstractmethod
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from ...core import StrategyBase
|
|
5
|
+
|
|
6
|
+
__all__ = ["Value"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Value(StrategyBase):
|
|
10
|
+
strategy_name = "org.platynui.strategies.Value"
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def value(self) -> Any:
|
|
15
|
+
pass
|
PlatynUI/ui/table.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from ..core import LocatorScope, context
|
|
4
|
+
from ..core.strategies import *
|
|
5
|
+
from . import Control, Item
|
|
6
|
+
|
|
7
|
+
__all__ = ["Table", "Cell", "Row"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@context
|
|
11
|
+
class Cell(Item):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@context
|
|
16
|
+
class Row(Item):
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def column_count(self):
|
|
20
|
+
self.ensure_that(self._application_is_ready)
|
|
21
|
+
|
|
22
|
+
return self.adapter.get_strategy(Properties).get_property_value("ColumnCount")
|
|
23
|
+
|
|
24
|
+
def get_cells(self, *args, **kwargs) -> typing.List[Cell]:
|
|
25
|
+
return self.get_all(Cell, scope=LocatorScope.Children, *args, **kwargs)
|
|
26
|
+
|
|
27
|
+
def iter_cells(self, *args, **kwargs) -> typing.Iterator[Cell]:
|
|
28
|
+
return self.iter_all(Cell, scope=LocatorScope.Children, *args, **kwargs)
|
|
29
|
+
|
|
30
|
+
def get_cell(self, *args, **kwargs) -> Cell:
|
|
31
|
+
return self.get(Cell, scope=LocatorScope.Children, *args, **kwargs)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@context
|
|
35
|
+
class Table(Control):
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def row_count(self):
|
|
39
|
+
self.ensure_that(self._application_is_ready)
|
|
40
|
+
|
|
41
|
+
return self.adapter.get_strategy(Properties).get_property_value("RowCount")
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def column_count(self):
|
|
45
|
+
self.ensure_that(self._application_is_ready)
|
|
46
|
+
|
|
47
|
+
return self.adapter.get_strategy(Properties).get_property_value("ColumnCount")
|
|
48
|
+
|
|
49
|
+
def get_rows(self, *args, **kwargs) -> typing.List[Row]:
|
|
50
|
+
return self.get_all(Row, scope=LocatorScope.Children, *args, **kwargs)
|
|
51
|
+
|
|
52
|
+
def iter_rows(self, *args, **kwargs) -> typing.Iterator[Row]:
|
|
53
|
+
return self.iter_all(Row, scope=LocatorScope.Children, *args, **kwargs)
|
|
54
|
+
|
|
55
|
+
def get_row(self, *args, **kwargs) -> Row:
|
|
56
|
+
return self.get(Row, scope=LocatorScope.Children, *args, **kwargs)
|
PlatynUI/ui/tabs.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from ..core import LocatorScope, context
|
|
4
|
+
from . import Control, Item
|
|
5
|
+
|
|
6
|
+
__all__ = ["TabList", "TabItem"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@context
|
|
10
|
+
class TabItem(Item):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@context
|
|
15
|
+
class TabList(Control):
|
|
16
|
+
def get_items(self, *args, **kwargs) -> typing.List[TabItem]:
|
|
17
|
+
return self.get_all(TabItem, scope=LocatorScope.Children, *args, **kwargs)
|
|
18
|
+
|
|
19
|
+
def iter_items(self, *args, **kwargs) -> typing.Iterator[TabItem]:
|
|
20
|
+
return self.iter_all(TabItem, scope=LocatorScope.Children, *args, **kwargs)
|
|
21
|
+
|
|
22
|
+
def get_item(self, *args, **kwargs) -> TabItem:
|
|
23
|
+
return self.get(TabItem, scope=LocatorScope.Children, *args, **kwargs)
|
|
24
|
+
|
|
25
|
+
def select(self, *args, **kwargs) -> TabItem:
|
|
26
|
+
result = self.get_item(*args, **kwargs)
|
|
27
|
+
result.select()
|
|
28
|
+
return result
|
PlatynUI/ui/text.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from ..core import context
|
|
2
|
+
from . import Control, strategies
|
|
3
|
+
|
|
4
|
+
__all__ = ["Text"]
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@context
|
|
8
|
+
class Text(Control):
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def text(self) -> str:
|
|
12
|
+
self.ensure_that(self._application_is_ready)
|
|
13
|
+
|
|
14
|
+
return self.adapter.get_strategy(strategies.Text).text
|
PlatynUI/ui/tree.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from ..core import LocatorScope, context
|
|
4
|
+
from ..core.strategies import Properties
|
|
5
|
+
from . import Control, Item, strategies
|
|
6
|
+
|
|
7
|
+
__all__ = ["Tree", "TreeItem"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@context
|
|
11
|
+
class TreeItem(Item):
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def item_count(self) -> int:
|
|
15
|
+
self.ensure_that(self._application_is_ready)
|
|
16
|
+
|
|
17
|
+
return self.adapter.get_strategy(Properties).get_property_value("ItemCount")
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def column_count(self) -> int:
|
|
21
|
+
self.ensure_that(self._application_is_ready)
|
|
22
|
+
|
|
23
|
+
return self.adapter.get_strategy(Properties).get_property_value("ColumnCount")
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def can_expand(self) -> bool:
|
|
27
|
+
self.ensure_that(self._application_is_ready)
|
|
28
|
+
|
|
29
|
+
return self.adapter.get_strategy(strategies.HasExpanded).can_expand
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def is_expanded(self) -> bool:
|
|
33
|
+
self.ensure_that(self._application_is_ready)
|
|
34
|
+
|
|
35
|
+
return self.adapter.get_strategy(strategies.HasExpanded).is_expanded
|
|
36
|
+
|
|
37
|
+
def expand(self) -> bool:
|
|
38
|
+
if not self.can_expand:
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
if self.is_expanded:
|
|
42
|
+
return True
|
|
43
|
+
|
|
44
|
+
self.ensure_that(self._toplevel_parent_is_active, self._element_is_in_view)
|
|
45
|
+
|
|
46
|
+
self.adapter.get_strategy(strategies.Expandable).expand()
|
|
47
|
+
|
|
48
|
+
self.ensure_that(self._application_is_ready, raise_exception=False)
|
|
49
|
+
|
|
50
|
+
return True
|
|
51
|
+
|
|
52
|
+
def collapse(self) -> bool:
|
|
53
|
+
if not self.can_expand:
|
|
54
|
+
return False
|
|
55
|
+
|
|
56
|
+
if not self.is_expanded:
|
|
57
|
+
return True
|
|
58
|
+
|
|
59
|
+
self.ensure_that(self._toplevel_parent_is_active, self._element_is_in_view)
|
|
60
|
+
|
|
61
|
+
self.adapter.get_strategy(strategies.Expandable).collapse()
|
|
62
|
+
|
|
63
|
+
self.ensure_that(self._application_is_ready, raise_exception=False)
|
|
64
|
+
|
|
65
|
+
return True
|
|
66
|
+
|
|
67
|
+
def get_items(self, *args: typing.Any, **kwargs: typing.Any) -> typing.List["TreeItem"]:
|
|
68
|
+
return self.get_all(TreeItem, scope=LocatorScope.Children, *args, **kwargs)
|
|
69
|
+
|
|
70
|
+
def iter_items(self, *args: typing.Any, **kwargs: typing.Any) -> typing.Iterator["TreeItem"]:
|
|
71
|
+
return self.iter_all(TreeItem, scope=LocatorScope.Children, *args, **kwargs)
|
|
72
|
+
|
|
73
|
+
def get_item(self, *args: typing.Any, **kwargs: typing.Any) -> "TreeItem":
|
|
74
|
+
return self.get(TreeItem, scope=LocatorScope.Children, *args, **kwargs)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@context
|
|
78
|
+
class Tree(Control):
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def item_count(self):
|
|
82
|
+
self.ensure_that(self._application_is_ready)
|
|
83
|
+
|
|
84
|
+
return self.adapter.get_strategy(Properties).get_property_value("ItemCount")
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def column_count(self):
|
|
88
|
+
self.ensure_that(self._application_is_ready)
|
|
89
|
+
|
|
90
|
+
return self.adapter.get_strategy(Properties).get_property_value("ColumnCount")
|
|
91
|
+
|
|
92
|
+
def get_items(self, *args, **kwargs) -> typing.List[TreeItem]:
|
|
93
|
+
return self.get_all(TreeItem, scope=LocatorScope.Children, *args, **kwargs)
|
|
94
|
+
|
|
95
|
+
def iter_items(self, *args, **kwargs) -> typing.Iterator[TreeItem]:
|
|
96
|
+
return self.iter_all(TreeItem, scope=LocatorScope.Children, *args, **kwargs)
|
|
97
|
+
|
|
98
|
+
def get_item(self, *args, **kwargs) -> TreeItem:
|
|
99
|
+
return self.get(TreeItem, scope=LocatorScope.Children, *args, **kwargs)
|
PlatynUI/ui/unknown.py
ADDED
PlatynUI/ui/window.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from ..core import Settings, context
|
|
4
|
+
from ..core.predicate import predicate
|
|
5
|
+
from ..core.types import Point, Size
|
|
6
|
+
from . import strategies
|
|
7
|
+
from .control import Control
|
|
8
|
+
|
|
9
|
+
__all__ = ["Window"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@context
|
|
13
|
+
class Window(Control):
|
|
14
|
+
|
|
15
|
+
@predicate("parent window of element {0} is active")
|
|
16
|
+
def _toplevel_parent_is_active(self) -> bool:
|
|
17
|
+
if not self.is_active:
|
|
18
|
+
self.activate()
|
|
19
|
+
return False
|
|
20
|
+
return True
|
|
21
|
+
|
|
22
|
+
@predicate("window {0} is not minimized")
|
|
23
|
+
def _window_is_not_minimized(self) -> bool:
|
|
24
|
+
self.ensure_that(self._application_is_ready)
|
|
25
|
+
|
|
26
|
+
if self.adapter.get_strategy(strategies.HasCanMinimize).is_minimized:
|
|
27
|
+
self.adapter.get_strategy(strategies.Restorable).restore()
|
|
28
|
+
return False
|
|
29
|
+
|
|
30
|
+
return not self.adapter.get_strategy(strategies.HasCanMinimize).is_minimized
|
|
31
|
+
|
|
32
|
+
@predicate("window {0} is active")
|
|
33
|
+
def _window_is_active(self) -> bool:
|
|
34
|
+
self.ensure_that(self._element_is_visible, self._window_is_not_minimized)
|
|
35
|
+
|
|
36
|
+
if self.adapter.get_strategy(strategies.HasIsActive).is_active:
|
|
37
|
+
return True
|
|
38
|
+
|
|
39
|
+
self.adapter.get_strategy(strategies.Activatable).activate()
|
|
40
|
+
|
|
41
|
+
return self.adapter.get_strategy(strategies.HasIsActive).is_active
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def is_active(self) -> bool:
|
|
45
|
+
self.ensure_that(self._application_is_ready)
|
|
46
|
+
|
|
47
|
+
return self.adapter.get_strategy(strategies.HasIsActive).is_active
|
|
48
|
+
|
|
49
|
+
def activate(self) -> bool:
|
|
50
|
+
result = self.ensure_that(self._window_is_active)
|
|
51
|
+
|
|
52
|
+
self.ensure_that(self._application_is_ready, raise_exception=False)
|
|
53
|
+
|
|
54
|
+
return result
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def can_minimize(self) -> bool:
|
|
58
|
+
self.ensure_that(self._application_is_ready)
|
|
59
|
+
|
|
60
|
+
return self.adapter.get_strategy(strategies.HasCanMinimize).can_minimize
|
|
61
|
+
|
|
62
|
+
@predicate("window {0} is minimizeable")
|
|
63
|
+
def _window_is_minimizeable(self) -> bool:
|
|
64
|
+
return self.can_minimize
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def is_minimized(self) -> bool:
|
|
68
|
+
self.ensure_that(self._application_is_ready)
|
|
69
|
+
|
|
70
|
+
return self.adapter.get_strategy(strategies.HasCanMinimize).is_minimized
|
|
71
|
+
|
|
72
|
+
def minimize(self) -> None:
|
|
73
|
+
if self.is_minimized:
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
self.ensure_that(self._window_is_minimizeable, self._window_is_active)
|
|
77
|
+
|
|
78
|
+
self.adapter.get_strategy(strategies.Minimizable).minimize()
|
|
79
|
+
|
|
80
|
+
self.ensure_that(self._application_is_ready, raise_exception=False)
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def can_maximize(self) -> bool:
|
|
84
|
+
self.ensure_that(self._application_is_ready)
|
|
85
|
+
|
|
86
|
+
return self.adapter.get_strategy(strategies.HasCanMaximize).can_maximize
|
|
87
|
+
|
|
88
|
+
@predicate("window {0} is maximizeable")
|
|
89
|
+
def _window_is_maximizeable(self) -> bool:
|
|
90
|
+
return self.can_maximize
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def is_maximized(self) -> bool:
|
|
94
|
+
self.ensure_that(self._application_is_ready)
|
|
95
|
+
|
|
96
|
+
return self.adapter.get_strategy(strategies.HasCanMaximize).is_maximized
|
|
97
|
+
|
|
98
|
+
def maximize(self) -> None:
|
|
99
|
+
if self.is_maximized:
|
|
100
|
+
return
|
|
101
|
+
|
|
102
|
+
self.ensure_that(self._window_is_maximizeable, self._window_is_active)
|
|
103
|
+
|
|
104
|
+
self.adapter.get_strategy(strategies.Maximizable).maximize()
|
|
105
|
+
|
|
106
|
+
self.ensure_that(self._application_is_ready, raise_exception=False)
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def can_close(self) -> bool:
|
|
110
|
+
self.ensure_that(self._application_is_ready)
|
|
111
|
+
|
|
112
|
+
return self.adapter.get_strategy(strategies.HasCanClose).can_close
|
|
113
|
+
|
|
114
|
+
def close(self) -> None:
|
|
115
|
+
self.ensure_that(self._window_is_active)
|
|
116
|
+
|
|
117
|
+
self.adapter.get_strategy(strategies.Closeable).close()
|
|
118
|
+
|
|
119
|
+
self.ensure_that(
|
|
120
|
+
self._application_is_ready, timeout=Settings.current().window_close_timeout, raise_exception=False
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
def restore(self) -> None:
|
|
124
|
+
if self.is_maximized or self.is_minimized:
|
|
125
|
+
self.ensure_that(
|
|
126
|
+
self._application_is_ready,
|
|
127
|
+
self._element_is_visible,
|
|
128
|
+
self._window_is_active if self.is_maximized or self.is_minimized else None,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
self.adapter.get_strategy(strategies.Restorable).restore()
|
|
132
|
+
|
|
133
|
+
self.ensure_that(self._application_is_ready, raise_exception=False)
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def title(self) -> str:
|
|
137
|
+
self.ensure_that(self._application_is_ready)
|
|
138
|
+
|
|
139
|
+
return self.adapter.get_strategy(strategies.Title).title
|
|
140
|
+
|
|
141
|
+
@property
|
|
142
|
+
def text(self) -> str:
|
|
143
|
+
self.ensure_that(self._application_is_ready)
|
|
144
|
+
|
|
145
|
+
return self.adapter.get_strategy(strategies.Text).text
|
|
146
|
+
|
|
147
|
+
def move(self, x: Optional[float] = None, y: Optional[float] = None, pos: Point = None) -> None:
|
|
148
|
+
if pos is None and (x is None or y is None):
|
|
149
|
+
return
|
|
150
|
+
|
|
151
|
+
if pos is None:
|
|
152
|
+
pos = Point(x, y)
|
|
153
|
+
|
|
154
|
+
if not pos.is_valid:
|
|
155
|
+
return
|
|
156
|
+
|
|
157
|
+
self.ensure_that(self._application_is_ready, self._element_is_visible, self._window_is_active)
|
|
158
|
+
|
|
159
|
+
self.adapter.get_strategy(strategies.Movable).move(pos)
|
|
160
|
+
|
|
161
|
+
self.ensure_that(self._application_is_ready, raise_exception=False)
|
|
162
|
+
|
|
163
|
+
def resize(self, width: Optional[float] = None, height: Optional[float] = None, size: Size = None) -> None:
|
|
164
|
+
if size is None and (width is None or height is None):
|
|
165
|
+
return
|
|
166
|
+
|
|
167
|
+
if size is None:
|
|
168
|
+
size = Size(width, height)
|
|
169
|
+
|
|
170
|
+
if not size.is_valid:
|
|
171
|
+
return
|
|
172
|
+
|
|
173
|
+
self.ensure_that(self._application_is_ready, self._element_is_visible, self._window_is_active)
|
|
174
|
+
|
|
175
|
+
self.adapter.get_strategy(strategies.Resizable).resize(size)
|
|
176
|
+
|
|
177
|
+
self.ensure_that(self._application_is_ready, raise_exception=False)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: robotframework-platynui
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: PlatynUI is a library for Robot Framework that enables easy and cross-platform desktop UI automation with a comprehensive set of keywords for interacting with desktop applications.
|
|
5
|
+
Project-URL: Documentation, https://github.com/imbus/robotframework-platynui#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/imbus/robotframework-platynui/issues
|
|
7
|
+
Project-URL: Source, https://github.com/imbus/robotframework-platynui
|
|
8
|
+
Author-email: Daniel Biehl <daniel.biehl@imbus.de>
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Framework :: Robot Framework :: Library
|
|
13
|
+
Classifier: Programming Language :: C#
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Requires-Dist: pythonnet>=3.0.0
|
|
24
|
+
Requires-Dist: robotframework-assertion-engine>=3.0.0
|
|
25
|
+
Requires-Dist: robotframework-pythonlibcore>=4.4.0
|
|
26
|
+
Requires-Dist: typing-extensions
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# robotframework-PlatynUI
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/robotframework-platynui)
|
|
32
|
+
[](https://pypi.org/project/robotframework-platynui)
|
|
33
|
+
|
|
34
|
+
-----
|
|
35
|
+
|
|
36
|
+
## Table of Contents
|
|
37
|
+
|
|
38
|
+
- [Installation](#installation)
|
|
39
|
+
- [License](#license)
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```console
|
|
44
|
+
pip install robotframework-platynui
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
`robotframework-platynui` is distributed under the terms of the [Apache 2.0](https://spdx.org/licenses/Apache-2.0.html) license.
|