@@ -417,6 +417,106 @@ def wait_until_element_does_not_contain(
417
417
error ,
418
418
)
419
419
420
+ @keyword
421
+ def wait_until_textarea_contains (
422
+ self ,
423
+ locator : Union [WebElement , None , str ],
424
+ text : str ,
425
+ timeout : Optional [timedelta ] = None ,
426
+ message : Optional [str ] = None ,
427
+ ):
428
+ """Waits until the textarea ``locator`` contains ``text``.
429
+
430
+ Fails if ``timeout`` expires before the text appears. See
431
+ the `Timeouts` section for more information about using timeouts and
432
+ their default value and the `Locating elements` section for details
433
+ about the locator syntax.
434
+
435
+ The ``message`` argument can be used to override the default error
436
+ message.
437
+ """
438
+ self ._wait_until (
439
+ lambda : text in self ._get_value (locator , "text area" ),
440
+ f"Textarea '{ locator } ' did not get text '{ text } ' in <TIMEOUT>." ,
441
+ timeout ,
442
+ message ,
443
+ )
444
+
445
+ @keyword
446
+ def wait_until_textarea_does_not_contain (
447
+ self ,
448
+ locator : Union [WebElement , None , str ],
449
+ text : str ,
450
+ timeout : Optional [timedelta ] = None ,
451
+ message : Optional [str ] = None ,
452
+ ):
453
+ """Waits until the textarea ``locator`` does not contain ``text``.
454
+
455
+ Fails if ``timeout`` expires before the text disappears. See
456
+ the `Timeouts` section for more information about using timeouts and
457
+ their default value and the `Locating elements` section for details
458
+ about the locator syntax.
459
+
460
+ The ``message`` argument can be used to override the default error
461
+ message.
462
+ """
463
+ self ._wait_until (
464
+ lambda : text not in self ._get_value (locator , "text area" ),
465
+ f"Textarea '{ locator } ' still had text '{ text } ' after <TIMEOUT>." ,
466
+ timeout ,
467
+ message ,
468
+ )
469
+
470
+ @keyword
471
+ def wait_until_textarea_value_is (
472
+ self ,
473
+ locator : Union [WebElement , None , str ],
474
+ text : str ,
475
+ timeout : Optional [timedelta ] = None ,
476
+ message : Optional [str ] = None ,
477
+ ):
478
+ """Waits until the textarea ``locator`` has exactly text ``text``.
479
+
480
+ Fails if ``timeout`` expires before the text appears. See
481
+ the `Timeouts` section for more information about using timeouts and
482
+ their default value and the `Locating elements` section for details
483
+ about the locator syntax.
484
+
485
+ The ``message`` argument can be used to override the default error
486
+ message.
487
+ """
488
+ self ._wait_until (
489
+ lambda : text == self ._get_value (locator , "text area" ),
490
+ f"Textarea '{ locator } ' did not get text '{ text } ' in <TIMEOUT>." ,
491
+ timeout ,
492
+ message ,
493
+ )
494
+
495
+ @keyword
496
+ def wait_until_textarea_value_is_not (
497
+ self ,
498
+ locator : Union [WebElement , None , str ],
499
+ text : str ,
500
+ timeout : Optional [timedelta ] = None ,
501
+ message : Optional [str ] = None ,
502
+ ):
503
+ """Waits until the textarea ``locator`` does not has exactly text ``text``.
504
+
505
+ Fails if ``timeout`` expires before the text appears. See
506
+ the `Timeouts` section for more information about using timeouts and
507
+ their default value and the `Locating elements` section for details
508
+ about the locator syntax.
509
+
510
+ The ``message`` argument can be used to override the default error
511
+ message.
512
+ """
513
+ self ._wait_until (
514
+ lambda : text != self ._get_value (locator , "text area" ),
515
+ f"Textarea '{ locator } ' still had text '{ text } ' in <TIMEOUT>." ,
516
+ timeout ,
517
+ message ,
518
+ )
519
+
420
520
def _wait_until (self , condition , error , timeout = None , custom_error = None ):
421
521
timeout = self .get_timeout (timeout )
422
522
if custom_error is None :
@@ -441,3 +541,6 @@ def _wait_until_worker(self, condition, timeout, error):
441
541
not_found = None
442
542
time .sleep (0.2 )
443
543
raise AssertionError (not_found or error )
544
+
545
+ def _get_value (self , locator , tag ):
546
+ return self .find_element (locator , tag ).get_attribute ("value" )
0 commit comments