@@ -83,7 +83,7 @@ class ConditionsElement extends SimpleElement
83
83
*
84
84
* @var string
85
85
*/
86
- protected $ created = './/preceding-sibling:: li[1] ' ;
86
+ protected $ created = './ul/ li[1] ' ;
87
87
88
88
/**
89
89
* Children condition
@@ -97,7 +97,7 @@ class ConditionsElement extends SimpleElement
97
97
*
98
98
* @var string
99
99
*/
100
- protected $ param = './span[@class="rule-param"]/ span/ *[substring(@id,(string-length(@id)-%d+1))="%s"]/../.. ' ;
100
+ protected $ param = './span[span[ *[substring(@id,(string-length(@id)-%d+1))="%s"]]] ' ;
101
101
102
102
/**
103
103
* Key of last find param
@@ -194,9 +194,9 @@ protected function addConditionsCombination($condition, SimpleElement $context)
194
194
$ newCondition ->find ($ this ->addNew , Locator::SELECTOR_XPATH )->click ();
195
195
$ typeNewCondition = $ newCondition ->find ($ this ->typeNew , Locator::SELECTOR_XPATH , 'select ' );
196
196
$ typeNewCondition ->setValue ($ condition ['type ' ]);
197
- $ this ->ruleParamWait ();
198
197
199
- $ createdCondition = $ newCondition ->find ($ this ->created , Locator::SELECTOR_XPATH );
198
+ $ createdCondition = $ context ->find ($ this ->created , Locator::SELECTOR_XPATH );
199
+ $ this ->waitForCondition ($ createdCondition );
200
200
if (!empty ($ condition ['rules ' ])) {
201
201
$ this ->fillCondition ($ condition ['rules ' ], $ createdCondition );
202
202
}
@@ -243,9 +243,8 @@ function () use ($newCondition, $typeNew) {
243
243
}
244
244
);
245
245
$ newCondition ->find ($ this ->typeNew , Locator::SELECTOR_XPATH , 'select ' )->setValue ($ condition ['type ' ]);
246
- $ this ->ruleParamWait ();
247
-
248
- $ createdCondition = $ newCondition ->find ($ this ->created , Locator::SELECTOR_XPATH );
246
+ $ createdCondition = $ context ->find ($ this ->created , Locator::SELECTOR_XPATH );
247
+ $ this ->waitForCondition ($ createdCondition );
249
248
$ this ->fillCondition ($ condition ['rules ' ], $ createdCondition );
250
249
}
251
250
@@ -387,14 +386,11 @@ protected function resetKeyParam()
387
386
*
388
387
* @return void
389
388
*/
390
- protected function ruleParamWait ( )
389
+ protected function waitForCondition ( SimpleElement $ element )
391
390
{
392
- $ browser = $ this ;
393
- $ ruleParamWait = $ this ->ruleParamWait ;
394
- $ browser ->waitUntil (
395
- function () use ($ browser , $ ruleParamWait ) {
396
- $ element = $ browser ->find ($ ruleParamWait , Locator::SELECTOR_XPATH );
397
- return $ element ->isVisible () ? null : true ;
391
+ $ this ->waitUntil (
392
+ function () use ($ element ) {
393
+ return $ element ->getAttribute ('class ' ) == 'rule-param-wait ' ? null : true ;
398
394
}
399
395
);
400
396
}
0 commit comments