@@ -62,267 +62,6 @@ def find_object(
6262 return super ().find_object_from_object (
6363 altby .by , altby .value , camera_altby .by , camera_altby .value , enabled
6464 )
65- return AltObject (self ._altdriver , altObject )
66-
67- def get_screen_position (self ):
68- """Returns the screen position.
69-
70- Returns:
71- tuple: A tuple containing ``x`` and ``y``.
72-
73- """
74-
75- return self .x , self .y
76-
77- def get_world_position (self ):
78- """Returns the world position.
79-
80- Returns:
81- tuple: A tuple containing ``worldX``, ``worldY`` and ``worldZ``.
82-
83- """
84-
85- return self .worldX , self .worldY , self .worldZ
86-
87- def get_parent (self ):
88- """Returns the parent object.
89-
90- Returns:
91- AltObject: The parent object.
92-
93- """
94-
95- data = commands .FindObject .run (
96- self ._connection ,
97- By .PATH , "//*[@id={}]/.." .format (self .id ), By .NAME , "" , enabled = True
98- )
99-
100- return AltObject (self ._altdriver , data )
101-
102- def find_object_from_object (self , by , value , camera_by = By .NAME , camera_value = "" , enabled = True ):
103- """Returns the child of the object that meets the specified conditions."""
104-
105- data = commands .FindObjectFromObject .run (self ._connection ,
106- by , value , camera_by , camera_value , enabled , self )
107-
108- if data is None :
109- return None
110-
111- alt_object = AltObject (self , data )
112-
113- return alt_object
114-
115- def get_all_components (self ):
116- """Returns all components."""
117-
118- return commands .GetAllComponents .run (self ._connection , self )
119-
120- def wait_for_component_property (self , component_name , property_name ,
121- property_value , assembly , timeout = 20 , interval = 0.5 ,
122- get_property_as_string = False , max_depth = 2 ):
123- """Wait until a property has a specific value and returns the value of the given component property.
124-
125- Args:
126- component_name (:obj:`str`): The name of the component. If the component has a namespace the format should
127- look like this: ``"namespace.componentName"``.
128- property_name (:obj:`str`): The name of the property of which value you want. If the property is an array
129- you can specify which element of the array to return by doing ``property[index]``, or if you want a
130- property inside of another property you can get by doing ``property.subProperty``.
131- property_value(:obj:`str`): The value of the component expected
132- assembly (:obj:`str`): The name of the assembly containing the component.
133- timeout (:obj:`int`, optional): The number of seconds that it will wait for property.
134- interval (:obj:`float`, optional): The number of seconds after which it will try to find the object again.
135- The interval should be smaller than timeout.
136- get_property_as_string (:obj:`bool`, optional): A boolean value that makes the property_value
137- to be compared as a string with the property from the instrumented app.
138- max_depth (:obj:`int`, optional): An integer value that defines the maximum level from which to retrieve
139- properties.
140-
141- Returns:
142- str: The property value is serialized to a JSON string.
143-
144- """
145- return commands .WaitForComponentProperty .run (
146- component_name , property_name , property_value ,
147- assembly , self , timeout , interval , get_property_as_string , max_depth
148- )
149-
150- def get_component_property (self , component_name , property_name , assembly , max_depth = 2 ):
151- """Returns the value of the given component property.
152-
153- Args:
154- component_name (:obj:`str`): The name of the component. If the component has a namespace the format should
155- look like this: ``"namespace.componentName"``.
156- property_name (:obj:`str`): The name of the property of which value you want. If the property is an array
157- you can specify which element of the array to return by doing ``property[index]``, or if you want a
158- property inside of another property you can get by doing ``property.subProperty``.
159- assembly (:obj:`str`): The name of the assembly containing the component.
160- maxDepth (:obj:`int`, optional): Set how deep to serialize the property. Defaults to ``2``.
161-
162- Returns:
163- str: The property value is serialized to a JSON string.
164-
165- """
166-
167- return commands .GetComponentProperty .run (
168- self ._connection ,
169- component_name , property_name , assembly , max_depth , self
170- )
171-
172- def set_component_property (self , component_name , property_name , assembly , value ):
173- """Sets a value for a given component property.
174-
175- Args:
176- component_name (:obj:`str`): The name of the component. If the component has a namespace the format should
177- look like this: ``"namespace.componentName"``.
178- property_name (:obj:`str`): The name of the property of which value you want to set.
179- assembly (:obj:`str`): The name of the assembly containing the component.
180- value (:obj:`str`): The value to be set for the chosen component's property.
181-
182- Returns:
183- str: The property value is serialized to a JSON string.
184-
185- """
186-
187- return commands .SetComponentProperty .run (
188- self ._connection ,
189- component_name , property_name , value , assembly , self
190- )
191-
192- def call_component_method (self , component_name , method_name , assembly , parameters = None , type_of_parameters = None ):
193- """Invokes a method from an existing component of the object.
194-
195- Args:
196- component_name (:obj:`str`): The name of the script. If the script has a namespace the format should look
197- like this: ``"namespace.typeName"``.
198- method_name (:obj:`str`): The name of the public method that we want to call. If the method is inside a
199- static property/field to be able to call that method, methodName need to be the following format
200- ``"propertyName.MethodName"``.
201- assembly (:obj:`str`): The name of the assembly containing the script.
202- parameters (:obj:`list`, :obj:`tuple`, optional): Defaults to ``None``.
203- type_of_parameters (:obj:`list`, :obj:`tuple`, optional): Defaults to ``None``.
204-
205- Return:
206- str: The value returned by the method is serialized to a JSON string.
207-
208- """
209-
210- return commands .CallMethod .run (
211- self ._connection ,
212- component_name ,
213- method_name ,
214- alt_object = self ,
215- parameters = parameters ,
216- type_of_parameters = type_of_parameters ,
217- assembly = assembly
218- )
219-
220- def get_text (self ):
221- """Returns text value from a Button, Text, InputField. This also works with TextMeshPro elements.
222-
223- Returns:
224- str: The text value of the AltObject.
225-
226- """
227-
228- return commands .GetText .run (self ._connection , self )
229-
230- def set_text (self , text , submit = False ):
231- """Sets text value for a Button, Text or InputField. This also works with TextMeshPro elements.
232-
233- Args:
234- text (obj:`str`): The text to be set.
235- submit (obj:`bool`): If set will trigger a submit event.
236-
237- Returns:
238- AltObject: The current AltObject.
239-
240- """
241-
242- data = commands .SetText .run (self ._connection , text , self , submit )
243- return AltObject (self ._altdriver , data )
244-
245- def pointer_up (self ):
246- """Simulates pointer up action on the object.
247-
248- Returns:
249- AltObject: The current AltObject.
250-
251- """
252-
253- data = commands .PointerUp .run (self ._connection , self )
254- return AltObject (self ._altdriver , data )
255-
256- def pointer_down (self ):
257- """Simulates pointer down action on the object.
258-
259- Returns:
260- AltObject: The current AltObject.
261-
262- """
263-
264- data = commands .PointerDown .run (self ._connection , self )
265- return AltObject (self ._altdriver , data )
266-
267- def pointer_enter (self ):
268- """Simulates pointer enter action on the object.
269-
270- Returns:
271- AltObject: The current AltObject.
272-
273- """
274-
275- data = commands .PointerEnter .run (self ._connection , self )
276- return AltObject (self ._altdriver , data )
277-
278- def pointer_exit (self ):
279- """Simulates pointer exit action on the object.
280-
281- Returns:
282- AltObject: The current AltObject.
283-
284- """
285-
286- data = commands .PointerExit .run (self ._connection , self )
287- return AltObject (self ._altdriver , data )
288-
289- def tap (self , count = 1 , interval = 0.1 , wait = True ):
290- """Taps the current object.
291-
292- Args:
293- count (:obj:`int`, optional): Number of taps. Defaults to ``1``.
294- interval (:obj:`int`, :obj:`float`, optional): Interval between taps in seconds. Defaults to ``0.1``.
295- wait (:obj:`int`, optional): Wait for command to finish. Defaults to ``True``.
296-
297- Returns:
298- AltObject: The tapped object.
299-
300- """
301-
302- data = commands .TapElement .run (
303- self ._connection ,
304- self , count , interval , wait
305- )
306- return AltObject (self ._altdriver , data )
307-
308- def click (self , count = 1 , interval = 0.1 , wait = True ):
309- """Clicks the current object.
310-
311- Args:
312- count (:obj:`int`, optional): Number of clicks. Defaults to ``1``.
313- interval (:obj:`int`, :obj:`float`, optional): Interval between clicks in seconds. Defaults to ``0.1``.
314- wait (:obj:`int`, optional): Wait for command to finish. Defaults to ``True``.
315-
316- Returns:
317- AltObject: The clicked object.
318-
319- """
320-
321- data = commands .ClickElement .run (
322- self ._connection ,
323- self , count , interval , wait
324- )
325- return AltObject (self ._altdriver , data )
32665
32766 def get_visual_element_property (self , property_name : str ) -> str :
32867 """Gets a value for a given visual element property.
@@ -339,7 +78,7 @@ def get_visual_element_property(self, property_name: str) -> str:
33978 if self .type != "UIToolkit" :
34079 raise exceptions .WrongAltObjectTypeException (
34180 "This method is only available for VisualElement objects" )
342- return commands .GetVisualElementProperty .run (self ._connection , property_name , self )
81+ return commands .GetVisualElementProperty .run (self ._connection , property_name , self )
34382
34483 def wait_for_visual_element_property (self , property_name ,
34584 property_value , timeout = 20 , interval = 0.5 ,
0 commit comments