@@ -253,6 +253,44 @@ def textfield_value_should_be(self, locator, expected, message=''):
253
253
raise AssertionError (message )
254
254
self ._info ("Content of text field '%s' is '%s'." % (locator , expected ))
255
255
256
+ def textarea_should_contain (self , locator , expected , message = '' ):
257
+ """Verifies text area identified by `locator` contains text `expected`.
258
+
259
+ `message` can be used to override default error message.
260
+
261
+ Key attributes for text areas are `id` and `name`. See `introduction`
262
+ for details about locating elements.
263
+ """
264
+ actual = self ._get_value (locator , 'text area' )
265
+ if actual is not None :
266
+ if not expected in actual :
267
+ if not message :
268
+ message = "Text field '%s' should have contained text '%s' " \
269
+ "but it contained '%s'" % (locator , expected , actual )
270
+ raise AssertionError (message )
271
+ else :
272
+ raise ValueError ("Element locator '" + locator + "' did not match any elements." )
273
+ self ._info ("Text area '%s' contains text '%s'." % (locator , expected ))
274
+
275
+ def textarea_value_should_be (self , locator , expected , message = '' ):
276
+ """Verifies the value in text area identified by `locator` is exactly `expected`.
277
+
278
+ `message` can be used to override default error message.
279
+
280
+ Key attributes for text areas are `id` and `name`. See `introduction`
281
+ for details about locating elements.
282
+ """
283
+ actual = self ._get_value (locator , 'text area' )
284
+ if actual is not None :
285
+ if expected != actual :
286
+ if not message :
287
+ message = "Text field '%s' should have contained text '%s' " \
288
+ "but it contained '%s'" % (locator , expected , actual )
289
+ raise AssertionError (message )
290
+ else :
291
+ raise ValueError ("Element locator '" + locator + "' did not match any elements." )
292
+ self ._info ("Content of text area '%s' is '%s'." % (locator , expected ))
293
+
256
294
# Public, buttons
257
295
258
296
def click_button (self , locator ):
0 commit comments