You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Docs/source/pages/commands.md
+55-48Lines changed: 55 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,42 @@ An AltDriver instance will connect to the running instrumented Unity application
22
22
| deviceInstanceId| string | No | The device instance id of the Unity application. The default value is`unknown`. |
23
23
| appId | string | No | The unique id of the Unity application. The default value is `unknown`. |
24
24
25
+
**_Examples_**
26
+
27
+
```eval_rst
28
+
.. tabs::
29
+
30
+
.. code-tab:: c#
31
+
32
+
[Test]
33
+
public void MyTest()
34
+
{
35
+
AltDriver altDriver = new AltDriver(host: "127.0.0.1", port: 13000);
36
+
}
37
+
38
+
.. code-tab:: java
39
+
40
+
@Test
41
+
public void MyTest()
42
+
{
43
+
AltDriver altDriver = new AltDriver(host: "127.0.0.1", port: 13000);
44
+
}
45
+
46
+
.. code-tab:: py
47
+
48
+
def my_test(self):
49
+
alt_driver = AltDriver(
50
+
host="127.0.0.1",
51
+
port=13000
52
+
)
53
+
54
+
.. code-tab:: robot
55
+
56
+
My Test
57
+
Initialize AltDriver host="127.0.0.1" port=13000
58
+
59
+
```
60
+
25
61
Once you have an instance of the _AltDriver_, you can use all the available commands to interact with the app. The available methods are the following:
26
62
27
63
### Find Objects
@@ -451,7 +487,7 @@ Returns information about every objects loaded in the currently loaded scenes. T
451
487
452
488
#### WaitForObject
453
489
454
-
Waits until it finds an object that respects the given criteria or until timeout limit is reached. Check [By](#by-selector) for more information about criteria.
490
+
Waits until it finds an object that respects the given criteria or until the timeout limit is reached. Check [By](#by-selector) for more information about criteria.
455
491
456
492
```eval_rst
457
493
@@ -469,8 +505,8 @@ Waits until it finds an object that respects the given criteria or until timeout
469
505
| cameraBy | [By](#by-selector) | No | Set what criteria to use in order to find the camera. |
470
506
| cameraValue | string | No | The value to which all the cameras in the scene will be compared to see if they respect the criteria or not to get the camera for which the screen coordinate of the object will be calculated. If no camera is given It will search through all camera that are in the scene until some camera sees the object or return the screen coordinate of the object calculated to the last camera in the scene. |
471
507
| enabled | boolean | No | If `true` will match only objects that are active in hierarchy. If `false` will match all objects. |
472
-
| timeout | double | No | The number of seconds that it will wait for object. |
473
-
| interval | double | No | The number of seconds after which it will try to find the object again. The interval should be smaller than timeout. |
508
+
| timeout | double | No | The number of seconds that it will wait for the object. By default it is set to 20 seconds. |
509
+
| interval | double | No | The number of seconds after which it will try to find the object again. The interval should be smaller than the timeout. |
474
510
475
511
**_Returns_**
476
512
@@ -484,48 +520,33 @@ Waits until it finds an object that respects the given criteria or until timeout
484
520
.. code-tab:: c#
485
521
486
522
[Test]
487
-
public void TestWaitForExistingElement()
523
+
public void TestWaitForObject()
488
524
{
489
525
const string name = "Capsule";
490
-
var timeStart = DateTime.Now;
491
-
var altElement = altDriver.WaitForObject(By.NAME, name);
492
-
var timeEnd = DateTime.Now;
493
-
var time = timeEnd - timeStart;
494
-
Assert.Less(time.TotalSeconds, 20);
495
-
Assert.NotNull(altElement);
496
-
Assert.AreEqual(altElement.name, name);
526
+
var altObject = altDriver.WaitForObject(By.NAME, name);
497
527
}
498
528
499
529
.. code-tab:: java
500
530
501
531
@Test
502
-
public void testWaitForExistingElement() {
532
+
public void testWaitForObject() {
503
533
String name = "Capsule";
504
-
long timeStart = System.currentTimeMillis();
505
534
AltFindObjectsParams altFindObjectsParams = new AltFindObjectsParams.Builder(AltDriver.By.NAME,
506
535
name).build();
507
536
AltWaitForObjectsParams altWaitForObjectsParams = new AltWaitForObjectsParams.Builder(
@@ -549,7 +570,7 @@ Waits until it finds an object that respects the given criteria or time runs out
549
570
| cameraBy | [By](#by-selector) | No | Set what criteria to use in order to find the camera. |
550
571
| cameraValue | string | No | The value to which all the cameras in the scene will be compared to see if they respect the criteria or not to get the camera for which the screen coordinate of the object will be calculated. If no camera is given It will search through all camera that are in the scene until some camera sees the object or return the screen coordinate of the object calculated to the last camera in the scene. |
551
572
| enabled | boolean | No | If `true` will match only objects that are active in hierarchy. If `false` will match all objects. |
552
-
| timeout | double | No | The number of seconds that it will wait for object |
573
+
| timeout | double | No | The number of seconds that it will wait for the object. By default it is set to 20 seconds. |
553
574
| interval | double | No | The number of seconds after which it will try to find the object again. interval should be smaller than timeout |
554
575
555
576
**_Returns_**
@@ -567,44 +588,33 @@ Waits until it finds an object that respects the given criteria or time runs out
567
588
public void TestWaitForObjectWhichContains()
568
589
{
569
590
var altObject = altDriver.WaitForObjectWhichContains(By.NAME, "Canva");
570
-
Assert.AreEqual("Canvas", altObject.name);
571
591
}
572
592
573
593
.. code-tab:: java
574
594
575
595
@Test
576
-
public void TestWaitForObjectWhichContainsWithCameraId() {
577
-
AltFindObjectsParams altFindObjectsParametersCamera = new AltFindObjectsParams.Builder(By.PATH,
578
-
"//Main Camera").build();
579
-
AltObject camera = altDriver.findObject(altFindObjectsParametersCamera);
580
-
581
-
AltFindObjectsParams altFindObjectsParametersObject = new AltFindObjectsParams.Builder(By.NAME, "Canva")
${alt_object}= Wait For Object Which Contains NAME Main
600
-
${alt_object_name}= Get Object Name ${alt_object}
601
-
Should Be Equal As Strings ${alt_object_name} Main Camera
611
+
${alt_object}= Wait For Object Which Contains NAME Canva
602
612
603
613
```
604
614
605
615
#### WaitForObjectNotBePresent
606
616
607
-
Waits until the object in the scene that respects the given criteria is no longer in the scene or until timeout limit is reached. Check [By](#by-selector) for more information about criteria.
617
+
Waits until the object in the scene that respects the given criteria is no longer in the scene or until the timeout limit is reached. Check [By](#by-selector) for more information about criteria.
608
618
609
619
```eval_rst
610
620
@@ -622,7 +632,7 @@ Waits until the object in the scene that respects the given criteria is no longe
622
632
| cameraBy | [By](#by-selector) | No | Set what criteria to use in order to find the camera. |
623
633
| cameraValue | string | No | The value to which all the cameras in the scene will be compared to see if they respect the criteria or not to get the camera for which the screen coordinate of the object will be calculated. If no camera is given It will search through all camera that are in the scene until some camera sees the object or return the screen coordinate of the object calculated to the last camera in the scene. |
624
634
| enabled | boolean | No | If `true` will match only objects that are active in hierarchy. If `false` will match all objects. |
625
-
| timeout | double | No | The number of seconds that it will wait for object. |
635
+
| timeout | double | No | The number of seconds that it will wait for the object. By default it is set to 20 seconds. |
626
636
| interval | double | No | The number of seconds after which it will try to find the object again. interval should be smaller than timeout. |
627
637
628
638
**_Returns_**
@@ -637,9 +647,9 @@ Waits until the object in the scene that respects the given criteria is no longe
0 commit comments