MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / post_success_message

Method post_success_message

seleniumbase/fixtures/base_case.py:10210–10236  ·  view source on GitHub ↗

Post a success message on the screen with Messenger. Arguments: message: The success message to display. duration: The time until the message vanishes. (Default: 2.55s) pause: If True, the program waits until the message completes.

(self, message, duration=None, pause=True)

Source from the content-addressed store, hash-verified

10208 self.__highlight_with_assert_success(message, selector, by=by)
10209
10210 def post_success_message(self, message, duration=None, pause=True):
10211 """Post a success message on the screen with Messenger.
10212 Arguments:
10213 message: The success message to display.
10214 duration: The time until the message vanishes. (Default: 2.55s)
10215 pause: If True, the program waits until the message completes."""
10216 self.__check_scope()
10217 self._check_browser()
10218 if not duration:
10219 if not self.message_duration:
10220 duration = settings.DEFAULT_MESSAGE_DURATION
10221 else:
10222 duration = self.message_duration
10223 if (
10224 (self.headless or self.headless2 or self.xvfb)
10225 and float(duration) > 0.75
10226 ):
10227 duration = 0.75
10228 try:
10229 js_utils.post_message(
10230 self.driver, message, duration, style="success"
10231 )
10232 except Exception:
10233 print(" * SUCCESS message: %s" % message)
10234 if pause:
10235 duration = float(duration) + 0.15
10236 time.sleep(float(duration))
10237
10238 def post_error_message(self, message, duration=None, pause=True):
10239 """Post an error message on the screen with Messenger.

Callers

nothing calls this directly

Calls 4

__check_scopeMethod · 0.95
_check_browserMethod · 0.95
post_messageMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected