Skip to content

4.6.4 - Add arg for excluding URLs from assert_no_js_errors()

Compare
Choose a tag to compare
@mdmintz mdmintz released this 20 Oct 22:58
· 1567 commits to master since this release
1d09bf3

Add arg for excluding URLs from assert_no_js_errors()

  • Add arg for excluding URLs from assert_no_js_errors()

    def assert_no_js_errors(self, exclude=[]):
        """Asserts current URL has no "SEVERE"-level JavaScript errors.
        Works ONLY on Chromium browsers (Chrome or Edge).
        Does NOT work on Firefox, IE, Safari, or some other browsers:
            * See https://github.com/SeleniumHQ/selenium/issues/1161
        Based on the following Stack Overflow solution:
            * https://stackoverflow.com/a/41150512/7058266
        @Params
        exclude -->
            A list of substrings or a single comma-separated string of
            substrings for filtering out error URLs that contain them.
            URLs that contain any excluded substring will get excluded
            from the final errors list that's used with the assertion.
        Examples:
            self.assert_no_js_errors()
            self.assert_no_js_errors(exclude=["/api.", "/analytics."])
            self.assert_no_js_errors(exclude="//api.go,/analytics.go")
        """