@@ -75,9 +75,12 @@ public function wait(float $time = 30.0): PromiseInterface;
75
75
* A condition callback must return an instance of PromiseInterface. Whenever that promise becomes rejected, driver
76
76
* will try to get a new promise from the callback, until it reaches a given timeout for retry attempts.
77
77
*
78
- * Note: waitUntil itself doesn't apply any timeouts for a single result promise (check iteration), the user-side
78
+ * Note 1 : waitUntil itself doesn't apply any timeouts for a single result promise (check iteration), the user-side
79
79
* MUST control any kind of promise timeouts for the condition callback, which is supplied to the method.
80
80
*
81
+ * Note 2: the resulting value for the waitUntil promise will be a value, which is forwarded by the condition
82
+ * callback (see an example below).
83
+ *
81
84
* Usage example:
82
85
*
83
86
* ```
@@ -90,16 +93,21 @@ public function wait(float $time = 30.0): PromiseInterface;
90
93
* if (!$isVisible) {
91
94
* throw new RuntimeException("Not visible yet! Let's retry!");
92
95
* }
96
+ *
97
+ * // this value will be forwarded as a "result value" for the waitUntil promise.
98
+ * return 'it is visible now!';
93
99
* }
94
100
* );
95
101
* },
96
102
* 15.5
97
103
* );
98
104
*
99
105
* $becomeVisiblePromise->then(
100
- * function () use ($webDriver) {
106
+ * function (string $forwardedValue ) use ($webDriver) {
101
107
* // try-catch
102
108
* $webDriver->clickElement(...); // sending a click command only if we are sure the target is visible.
109
+ *
110
+ * // $forwardedValue === 'it is visible now!'
103
111
* }
104
112
* // handle case when the element is not visible on the page
105
113
* );
@@ -109,7 +117,7 @@ public function wait(float $time = 30.0): PromiseInterface;
109
117
* @param float $time Time (in seconds) to wait for successfully resolved promise from the
110
118
* condition callback (minimum: 0.5)
111
119
*
112
- * @return PromiseInterface<null >
120
+ * @return PromiseInterface<mixed >
113
121
*/
114
122
public function waitUntil (callable $ conditionMetCallback , float $ time = 30.0 ): PromiseInterface ;
115
123
@@ -118,7 +126,7 @@ public function waitUntil(callable $conditionMetCallback, float $time = 30.0): P
118
126
* {filePath}, rejection reason with error message will be provided otherwise.
119
127
*
120
128
* @param string $sessionIdentifier Session identifier for Selenium Grid server (hub)
121
- * @param string $filePath Path where a screenshot image will be saved
129
+ * @param string $filePath Path, where a screenshot image must be saved
122
130
*
123
131
* @return PromiseInterface<null>
124
132
*/
0 commit comments