How to use __highlight_with_assert_success method in SeleniumBase

Best Python code snippet using SeleniumBase

asserts.py

Source:asserts.py Github

copy

Full Screen

...145 i_n,146 by.upper(),147 selector,148 )149 self.__highlight_with_assert_success(messenger_post, selector, by)150 return True151 def __assert_shadow_element_present(self, selector):152 self.__get_shadow_element(selector)153 if self.demo_mode:154 a_t = "ASSERT"155 by = By.CSS_SELECTOR156 if self._language != "English":157 from seleniumbase.fixtures.words import SD158 a_t = SD.translate_assert(self._language)159 messenger_post = "%s %s: %s" % (a_t, by.upper(), selector)160 try:161 js_utils.activate_jquery(self.driver)162 js_utils.post_messenger_success_message(163 self.driver, messenger_post, self.message_duration164 )165 except Exception:166 pass167 def __assert_shadow_element_visible(self, selector):168 element = self.__get_shadow_element(selector)169 if not element.is_displayed():170 msg = "Shadow DOM Element {%s} was not visible!" % selector171 page_actions.timeout_exception("NoSuchElementException", msg)172 if self.demo_mode:173 a_t = "ASSERT"174 by = By.CSS_SELECTOR175 if self._language != "English":176 from seleniumbase.fixtures.words import SD177 a_t = SD.translate_assert(self._language)178 messenger_post = "%s %s: %s" % (a_t, by.upper(), selector)179 try:180 js_utils.activate_jquery(self.driver)181 js_utils.post_messenger_success_message(182 self.driver, messenger_post, self.message_duration183 )184 except Exception:185 pass186 def __assert_eq(self, *args, **kwargs):187 """ Minified assert_equal() using only the list diff. """188 minified_exception = None189 try:190 self.assertEqual(*args, **kwargs)191 except Exception as e:192 str_e = str(e)193 minified_exception = "\nAssertionError:\n"194 lines = str_e.split("\n")195 countdown = 3196 countdown_on = False197 first_differing = False198 skip_lines = False199 for line in lines:200 if countdown_on:201 if not skip_lines:202 minified_exception += line + "\n"203 countdown = countdown - 1204 if countdown == 0:205 countdown_on = False206 skip_lines = False207 elif line.startswith("First differing"):208 first_differing = True209 countdown_on = True210 countdown = 3211 minified_exception += line + "\n"212 elif line.startswith("First list"):213 countdown_on = True214 countdown = 3215 if not first_differing:216 minified_exception += line + "\n"217 else:218 skip_lines = True219 elif line.startswith("F"):220 countdown_on = True221 countdown = 3222 minified_exception += line + "\n"223 elif line.startswith("+") or line.startswith("-"):224 minified_exception += line + "\n"225 elif line.startswith("?"):226 minified_exception += line + "\n"227 elif line.strip().startswith("*"):228 minified_exception += line + "\n"229 if minified_exception:230 raise Exception(minified_exception)231 def __assert_exact_shadow_text_visible(self, text, selector, timeout):232 self.__wait_for_exact_shadow_text_visible(text, selector, timeout)233 if self.demo_mode:234 a_t = "ASSERT EXACT TEXT"235 i_n = "in"236 by = By.CSS_SELECTOR237 if self._language != "English":238 from seleniumbase.fixtures.words import SD239 a_t = SD.translate_assert_exact_text(self._language)240 i_n = SD.translate_in(self._language)241 messenger_post = "%s: {%s} %s %s: %s" % (242 a_t,243 text,244 i_n,245 by.upper(),246 selector,247 )248 try:249 js_utils.activate_jquery(self.driver)250 js_utils.post_messenger_success_message(251 self.driver, messenger_post, self.message_duration252 )253 except Exception:254 pass255 def __assert_shadow_text_visible(self, text, selector, timeout):256 self.__wait_for_shadow_text_visible(text, selector, timeout)257 if self.demo_mode:258 a_t = "ASSERT TEXT"259 i_n = "in"260 by = By.CSS_SELECTOR261 if self._language != "English":262 from seleniumbase.fixtures.words import SD263 a_t = SD.translate_assert_text(self._language)264 i_n = SD.translate_in(self._language)265 messenger_post = "%s: {%s} %s %s: %s" % (266 a_t,267 text,268 i_n,269 by.upper(),270 selector,271 )272 try:273 js_utils.activate_jquery(self.driver)274 js_utils.post_messenger_success_message(275 self.driver, messenger_post, self.message_duration276 )277 except Exception:278 pass279 def assert_attribute_not_present(280 self, selector, attribute, value=None, by=By.CSS_SELECTOR, timeout=None281 ):282 """Similar to wait_for_attribute_not_present()283 Raises an exception if the attribute is still present after timeout.284 Returns True if successful. Default timeout = SMALL_TIMEOUT."""285 self.__check_scope__()286 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)287 return self.wait_for_attribute_not_present(288 selector, attribute, value=value, by=by, timeout=timeout289 )290 def assert_element(self, selector, by=By.CSS_SELECTOR, timeout=None):291 """Similar to wait_for_element_visible(), but returns nothing.292 As above, will raise an exception if nothing can be found.293 Returns True if successful. Default timeout = SMALL_TIMEOUT."""294 self.__check_scope()295 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)296 if type(selector) is list:297 self.assert_elements(selector, by=by, timeout=timeout)298 return True299 if self.__is_shadow_selector(selector):300 self.__assert_shadow_element_visible(selector)301 return True302 self.wait_for_element_visible(selector, by=by, timeout=timeout)303 if self.demo_mode:304 selector, by = self.__recalculate_selector(305 selector, by, xp_ok=False306 )307 a_t = "ASSERT"308 if self._language != "English":309 from seleniumbase.fixtures.words import SD310 a_t = SD.translate_assert(self._language)311 messenger_post = "%s %s: %s" % (a_t, by.upper(), selector)312 self.__highlight_with_assert_success(messenger_post, selector, by)313 return True314 def assert_element_visible(315 self, selector, by=By.CSS_SELECTOR, timeout=None316 ):317 """Same as self.assert_element()318 As above, will raise an exception if nothing can be found."""319 self.__check_scope()320 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)321 self.assert_element(selector, by=by, timeout=timeout)322 return True323 def assert_elements(self, *args, **kwargs):324 """Similar to self.assert_element(), but can assert multiple elements.325 The input is a list of elements.326 Optional kwargs include "by" and "timeout" (used by all selectors).327 Raises an exception if any of the elements are not visible.328 Examples:329 self.assert_elements("h1", "h2", "h3")330 OR331 self.assert_elements(["h1", "h2", "h3"])"""332 self.__check_scope()333 selectors = []334 timeout = None335 by = By.CSS_SELECTOR336 for kwarg in kwargs:337 if kwarg == "timeout":338 timeout = kwargs["timeout"]339 elif kwarg == "by":340 by = kwargs["by"]341 elif kwarg == "selector":342 selector = kwargs["selector"]343 if type(selector) is str:344 selectors.append(selector)345 elif type(selector) is list:346 selectors_list = selector347 for selector in selectors_list:348 if type(selector) is str:349 selectors.append(selector)350 else:351 raise Exception('Unknown kwarg: "%s"!' % kwarg)352 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)353 for arg in args:354 if type(arg) is list:355 for selector in arg:356 if type(selector) is str:357 selectors.append(selector)358 elif type(arg) is str:359 selectors.append(arg)360 for selector in selectors:361 if self.__is_shadow_selector(selector):362 self.__assert_shadow_element_visible(selector)363 continue364 self.wait_for_element_visible(selector, by=by, timeout=timeout)365 if self.demo_mode:366 selector, by = self.__recalculate_selector(selector, by)367 a_t = "ASSERT"368 if self._language != "English":369 from seleniumbase.fixtures.words import SD370 a_t = SD.translate_assert(self._language)371 messenger_post = "%s %s: %s" % (a_t, by.upper(), selector)372 self.__highlight_with_assert_success(373 messenger_post, selector, by374 )375 continue376 return True377 def assert_elements_visible(self, *args, **kwargs):378 """Same as self.assert_elements()379 Raises an exception if any element cannot be found."""380 return self.assert_elements(*args, **kwargs)381 def assert_element_absent(382 self, selector, by=By.CSS_SELECTOR, timeout=None383 ):384 """Similar to wait_for_element_absent()385 As above, will raise an exception if the element stays present.386 A hidden element counts as a present element, which fails this assert.387 If you want to assert that elements are hidden instead of nonexistent,388 use assert_element_not_visible() instead.389 (Note that hidden elements are still present in the HTML of the page.)390 Returns True if successful. Default timeout = SMALL_TIMEOUT."""391 self.__check_scope()392 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)393 self.wait_for_element_absent(selector, by=by, timeout=timeout)394 return True395 def assert_element_not_present(396 self, selector, by=By.CSS_SELECTOR, timeout=None397 ):398 """Same as self.assert_element_absent()399 Will raise an exception if the element stays present.400 A hidden element counts as a present element, which fails this assert.401 If you want to assert that elements are hidden instead of nonexistent,402 use assert_element_not_visible() instead.403 (Note that hidden elements are still present in the HTML of the page.)404 Returns True if successful. Default timeout = SMALL_TIMEOUT."""405 self.__check_scope()406 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)407 self.wait_for_element_absent(selector, by=by, timeout=timeout)408 return True409 def assert_element_not_visible(410 self, selector, by=By.CSS_SELECTOR, timeout=None411 ):412 """Similar to wait_for_element_not_visible()413 As above, will raise an exception if the element stays visible.414 Returns True if successful. Default timeout = SMALL_TIMEOUT."""415 self.__check_scope__()416 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)417 self.wait_for_element_not_visible(selector, by=by, timeout=timeout)418 return True419 def assert_element_present(420 self, selector, by=By.CSS_SELECTOR, timeout=None421 ):422 """Similar to wait_for_element_present(), but returns nothing.423 Waits for an element to appear in the HTML of a page.424 The element does not need be visible (it may be hidden).425 Returns True if successful. Default timeout = SMALL_TIMEOUT."""426 self.__check_scope()427 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)428 if type(selector) is list:429 self.assert_elements_present(selector, by=by, timeout=timeout)430 return True431 if self.__is_shadow_selector(selector):432 self.__assert_shadow_element_present(selector)433 return True434 self.wait_for_element_present(selector, by=by, timeout=timeout)435 return True436 def assert_elements_present(self, *args, **kwargs):437 """Similar to self.assert_element_present(),438 but can assert that multiple elements are present in the HTML.439 The input is a list of elements.440 Optional kwargs include "by" and "timeout" (used by all selectors).441 Raises an exception if any of the elements are not visible.442 Examples:443 self.assert_elements_present("head", "style", "script", "body")444 OR445 self.assert_elements_present(["head", "body", "h1", "h2"])446 """447 self.__check_scope()448 selectors = []449 timeout = None450 by = By.CSS_SELECTOR451 for kwarg in kwargs:452 if kwarg == "timeout":453 timeout = kwargs["timeout"]454 elif kwarg == "by":455 by = kwargs["by"]456 elif kwarg == "selector":457 selector = kwargs["selector"]458 if type(selector) is str:459 selectors.append(selector)460 elif type(selector) is list:461 selectors_list = selector462 for selector in selectors_list:463 if type(selector) is str:464 selectors.append(selector)465 else:466 raise Exception('Unknown kwarg: "%s"!' % kwarg)467 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)468 for arg in args:469 if type(arg) is list:470 for selector in arg:471 if type(selector) is str:472 selectors.append(selector)473 elif type(arg) is str:474 selectors.append(arg)475 for selector in selectors:476 if self.__is_shadow_selector(selector):477 self.__assert_shadow_element_visible(selector)478 continue479 self.wait_for_element_present(selector, by=by, timeout=timeout)480 continue481 return True482 def assert_text_visible(483 self, text, selector="html", by=By.CSS_SELECTOR, timeout=None484 ):485 """ Same as assert_text() """486 self.__check_scope()487 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)488 return self.assert_text(text, selector, by=by, timeout=timeout)489 def assert_text(490 self, text, selector="html", by=By.CSS_SELECTOR, timeout=None491 ):492 """Similar to wait_for_text_visible()493 Raises an exception if the element or the text is not found.494 The text only needs to be a subset within the complete text.495 Returns True if successful. Default timeout = SMALL_TIMEOUT."""496 self.__check_scope()497 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)498 selector, by = self.__recalculate_selector(selector, by)499 if self.__is_shadow_selector(selector):500 self.__assert_shadow_text_visible(text, selector, timeout)501 return True502 self.wait_for_text_visible(text, selector, by=by, timeout=timeout)503 if self.demo_mode:504 a_t = "ASSERT TEXT"505 i_n = "in"506 if self._language != "English":507 from seleniumbase.fixtures.words import SD508 a_t = SD.translate_assert_text(self._language)509 i_n = SD.translate_in(self._language)510 messenger_post = "%s: {%s} %s %s: %s" % (511 a_t,512 text,513 i_n,514 by.upper(),515 selector,516 )517 self.__highlight_with_assert_success(messenger_post, selector, by)518 return True519 def assert_exact_text(520 self, text, selector="html", by=By.CSS_SELECTOR, timeout=None521 ):522 """Similar to assert_text(), but the text must be exact,523 rather than exist as a subset of the full text.524 (Extra whitespace at the beginning or the end doesn't count.)525 Raises an exception if the element or the text is not found.526 Returns True if successful. Default timeout = SMALL_TIMEOUT."""527 self.__check_scope()528 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)529 selector, by = self.__recalculate_selector(selector, by)530 if self.__is_shadow_selector(selector):531 self.__assert_exact_shadow_text_visible(text, selector, timeout)532 return True533 self.wait_for_exact_text_visible(534 text, selector, by=by, timeout=timeout535 )536 if self.demo_mode:537 a_t = "ASSERT EXACT TEXT"538 i_n = "in"539 if self._language != "English":540 from seleniumbase.fixtures.words import SD541 a_t = SD.translate_assert_exact_text(self._language)542 i_n = SD.translate_in(self._language)543 messenger_post = "%s: {%s} %s %s: %s" % (544 a_t,545 text,546 i_n,547 by.upper(),548 selector,549 )550 self.__highlight_with_assert_success(messenger_post, selector, by)551 return True552 def assert_link_status_code_is_not_404(self, link):553 status_code = str(self.get_link_status_code(link))554 bad_link_str = 'Error: "%s" returned a 404!' % link555 self.assertNotEqual(status_code, "404", bad_link_str)556 def assert_link_text(self, link_text, timeout=None):557 """Similar to wait_for_link_text_visible(), but returns nothing.558 As above, will raise an exception if nothing can be found.559 Returns True if successful. Default timeout = SMALL_TIMEOUT."""560 self.__check_scope__()561 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)562 self.wait_for_link_text_visible(link_text, timeout=timeout)563 if self.demo_mode:564 a_t = "ASSERT LINK TEXT"565 messenger_post = "%s: {%s}" % (a_t, link_text)566 self.__highlight_with_assert_success(567 messenger_post, link_text, by=By.LINK_TEXT568 )569 return True570 def assert_no_404_errors(self, multithreaded=True, timeout=None):571 """Assert no 404 errors from page links obtained from:572 "a"->"href", "img"->"src", "link"->"href", and "script"->"src".573 Timeout is on a per-link basis using the "requests" library.574 (A 404 error represents a broken link on a web page.)575 """576 all_links = self.get_unique_links()577 links = []578 for link in all_links:579 if (580 "data:" not in link581 and "mailto:" not in link582 and "javascript:" not in link583 and "://fonts.gstatic.com" not in link584 and "://fonts.googleapis.com" not in link585 and "://googleads.g.doubleclick.net" not in link586 ):587 links.append(link)588 if timeout:589 if not type(timeout) is int and not type(timeout) is float:590 raise Exception('Expecting a numeric value for "timeout"!')591 if timeout < 0:592 raise Exception('The "timeout" cannot be a negative number!')593 self.__requests_timeout = timeout594 broken_links = []595 if multithreaded:596 from multiprocessing.dummy import Pool as ThreadPool597 pool = ThreadPool(10)598 results = pool.map(self.__get_link_if_404_error, links)599 pool.close()600 pool.join()601 for result in results:602 if result:603 broken_links.append(result)604 else:605 broken_links = []606 for link in links:607 if self.__get_link_if_404_error(link):608 broken_links.append(link)609 self.__requests_timeout = None # Reset the requests.get() timeout610 if len(broken_links) > 0:611 broken_links = sorted(broken_links)612 bad_links_str = "\n".join(broken_links)613 if len(broken_links) == 1:614 self.fail("Broken link detected:\n%s" % bad_links_str)615 elif len(broken_links) > 1:616 self.fail("Broken links detected:\n%s" % bad_links_str)617 if self.demo_mode:618 a_t = "ASSERT NO 404 ERRORS"619 if self._language != "English":620 from seleniumbase.fixtures.words import SD621 a_t = SD.translate_assert_no_404_errors(self._language)622 messenger_post = "%s" % a_t623 self.__highlight_with_assert_success(messenger_post, "html")624 def assert_no_broken_links(self, multithreaded=True):625 """ Same as self.assert_no_404_errors() """626 self.assert_no_404_errors(multithreaded=multithreaded)627 def assert_no_js_errors(self):628 """Asserts that there are no JavaScript "SEVERE"-level page errors.629 Works ONLY on Chromium browsers (Chrome or Edge).630 Does NOT work on Firefox, IE, Safari, or some other browsers:631 * See https://github.com/SeleniumHQ/selenium/issues/1161632 Based on the following Stack Overflow solution:633 * https://stackoverflow.com/a/41150512/7058266634 """635 self.__check_scope()636 time.sleep(0.1) # May take a moment for errors to appear after loads.637 try:638 browser_logs = self.driver.get_log("browser")639 except (ValueError, WebDriverException):640 # If unable to get browser logs, skip the assert and return.641 return642 messenger_library = "//cdnjs.cloudflare.com/ajax/libs/messenger"643 underscore_library = "//cdnjs.cloudflare.com/ajax/libs/underscore"644 errors = []645 for entry in browser_logs:646 if entry["level"] == "SEVERE":647 if (648 messenger_library not in entry["message"]649 and underscore_library not in entry["message"]650 ):651 # Add errors if not caused by SeleniumBase dependencies652 errors.append(entry)653 if len(errors) > 0:654 for n in range(len(errors)):655 f_t_l_r = " - Failed to load resource"656 u_c_t_e = " Uncaught TypeError: "657 if f_t_l_r in errors[n]["message"]:658 url = errors[n]["message"].split(f_t_l_r)[0]659 errors[n] = {"Error 404 (broken link)": url}660 elif u_c_t_e in errors[n]["message"]:661 url = errors[n]["message"].split(u_c_t_e)[0]662 error = errors[n]["message"].split(u_c_t_e)[1]663 errors[n] = {"Uncaught TypeError (%s)" % error: url}664 er_str = str(errors)665 er_str = er_str.replace("[{", "[\n{").replace("}, {", "},\n{")666 current_url = self.get_current_url()667 raise Exception(668 "JavaScript errors found on %s => %s" % (current_url, er_str)669 )670 if self.demo_mode:671 if self.browser == "chrome" or self.browser == "edge":672 a_t = "ASSERT NO JS ERRORS"673 if self._language != "English":674 from seleniumbase.fixtures.words import SD675 a_t = SD.translate_assert_no_js_errors(self._language)676 messenger_post = "%s" % a_t677 self.__highlight_with_assert_success(messenger_post, "html")678 def assert_partial_link_text(self, partial_link_text, timeout=None):679 """Similar to wait_for_partial_link_text(), but returns nothing.680 As above, will raise an exception if nothing can be found.681 Returns True if successful. Default timeout = SMALL_TIMEOUT."""682 self.__check_scope()683 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)684 self.wait_for_partial_link_text(partial_link_text, timeout=timeout)685 if self.demo_mode:686 a_t = "ASSERT PARTIAL LINK TEXT"687 messenger_post = "%s: {%s}" % (a_t, partial_link_text)688 self.__highlight_with_assert_success(689 messenger_post, partial_link_text, by=By.PARTIAL_LINK_TEXT690 )691 return True692 def assert_pdf_text(693 self,694 pdf,695 text,696 page=None,697 maxpages=None,698 password=None,699 codec="utf-8",700 wrap=True,701 nav=False,702 override=False,703 caching=True,704 ):705 """Asserts text in a PDF file.706 PDF can be either a URL or a file path on the local file system.707 @Params708 pdf - The URL or file path of the PDF file.709 text - The expected text to verify in the PDF.710 page - The page number of the PDF to use (optional).711 If a page number is provided, looks only at that page.712 (1 is the first page, 2 is the second page, etc.)713 If no page number is provided, looks at all the pages.714 maxpages - Instead of providing a page number, you can provide715 the number of pages to use from the beginning.716 password - If the PDF is password-protected, enter it here.717 codec - The compression format for character encoding.718 (The default codec used by this method is 'utf-8'.)719 wrap - Replaces ' \n' with ' ' so that individual sentences720 from a PDF don't get broken up into separate lines when721 getting converted into text format.722 nav - If PDF is a URL, navigates to the URL in the browser first.723 (Not needed because the PDF will be downloaded anyway.)724 override - If the PDF file to be downloaded already exists in the725 downloaded_files/ folder, that PDF will be used726 instead of downloading it again.727 caching - If resources should be cached via pdfminer."""728 text = self.__fix_unicode_conversion(text)729 if not codec:730 codec = "utf-8"731 pdf_text = self.get_pdf_text(732 pdf,733 page=page,734 maxpages=maxpages,735 password=password,736 codec=codec,737 wrap=wrap,738 nav=nav,739 override=override,740 caching=caching,741 )742 if type(page) is int:743 if text not in pdf_text:744 raise Exception(745 "PDF [%s] is missing expected text [%s] on "746 "page [%s]!" % (pdf, text, page)747 )748 else:749 if text not in pdf_text:750 raise Exception(751 "PDF [%s] is missing expected text [%s]!" % (pdf, text)752 )753 return True754 def assert_text_not_visible(755 self, text, selector="html", by=By.CSS_SELECTOR, timeout=None756 ):757 """Similar to wait_for_text_not_visible()758 Raises an exception if the text is still visible after timeout.759 Returns True if successful. Default timeout = SMALL_TIMEOUT."""760 self.__check_scope__()761 timeout = self.get_timeout(timeout, constants.SMALL_TIMEOUT)762 return self.wait_for_text_not_visible(763 text, selector, by=by, timeout=timeout764 )765 def assert_title(self, title):766 """Asserts that the web page title matches the expected title.767 When a web page initially loads, the title starts as the URL,768 but then the title switches over to the actual page title.769 In Recorder Mode, this assertion is skipped because the Recorder770 changes the page title to the selector of the hovered element.771 """772 self.wait_for_ready_state_complete()773 expected = title.strip()774 actual = self.get_page_title().strip()775 error = (776 "Expected page title [%s] does not match the actual title [%s]!"777 )778 try:779 if not self.recorder_mode:780 self.assertEqual(expected, actual, error % (expected, actual))781 except Exception:782 self.wait_for_ready_state_complete()783 self.sleep(settings.MINI_TIMEOUT)784 actual = self.get_page_title().strip()785 try:786 self.assertEqual(expected, actual, error % (expected, actual))787 except Exception:788 self.wait_for_ready_state_complete()789 self.sleep(settings.MINI_TIMEOUT)790 actual = self.get_page_title().strip()791 self.assertEqual(expected, actual, error % (expected, actual))792 if self.demo_mode and not self.recorder_mode:793 a_t = "ASSERT TITLE"794 if self._language != "English":795 from seleniumbase.fixtures.words import SD796 a_t = SD.translate_assert_title(self._language)797 messenger_post = "%s: {%s}" % (a_t, title)798 self.__highlight_with_assert_success(messenger_post, "html")...

Full Screen

Full Screen

baseCase.py

Source:baseCase.py Github

copy

Full Screen

...202 a_t = "ASSERT NO JS ERRORS"203 if self._language != "English":204 a_t = worlds.SD.translate_assert_no_js_errors(self._language)205 messenger_post = "%s" % a_t...

Full Screen

Full Screen

messenger.py

Source:messenger.py Github

copy

Full Screen

...76 selector: The selector of the Element to highlight.77 by: The type of selector to search by. (Default: CSS Selector)78 """79 self.__check_scope__()80 self.__highlight_with_assert_success(message, selector, by=by)81 def post_success_message(self, message, duration=None, pause=True):82 """Post a success message on the screen with Messenger.83 Arguments:84 message: The success message to display.85 duration: The time until the message vanishes. (Default: 2.55s)86 pause: If True, the program waits until the message completes.87 """88 self.__check_scope()89 self.__check_browser()90 if not duration:91 if not self.message_duration:92 duration = settings.DEFAULT_MESSAGE_DURATION93 else:94 duration = self.message_duration...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful