Improve reliability of the HTML-Inspector and JS-loading code
- The HTML-Inspector provides useful information about a web page.
- Example: examples/test_inspect_html.py (Chromium browsers only)
from seleniumbase import BaseCase
class HtmlInspectorTests(BaseCase):
def test_html_inspector(self):
self.open("https://xkcd.com/1144/")
self.inspect_html()
pytest test_inspect_html.py
============================ test session starts ============================
platform darwin -- Python 3.9.2, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /Users/michael/github/SeleniumBase/examples, configfile: pytest.ini
plugins: html-2.0.1, rerunfailures-9.1.1, xdist-2.2.1, metadata-1.11.0,
ordering-0.6, forked-1.3.0, seleniumbase-1.59.2
collected 1 item
test_inspect_html.py
* HTML Inspection Results: https://xkcd.com/1144/
X - https://xkcd.com/1144/ - Access to XMLHttpRequest at 'https://xkcd.com/usBanner' (redirected from 'https://c.xkcd.com/xkcd/news') from origin 'https://xkcd.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
X - https://xkcd.com/usBanner - Failed to load resource: net::ERR_FAILED
X - 'property' is not a valid attribute of the <meta> element.
X - Do not use <div> or <span> elements without any attributes.
X - The 'alt' attribute is required for <img> elements.
X - The 'border' attribute is no longer valid on the <img> element and should not be used.
X - 'srcset' is not a valid attribute of the <img> element.
X - The <center> element is obsolete and should not be used.
X - <script> elements should appear right before the closing </body> tag for optimal performance.
X - The id 'comicLinks' appears more than once in the document.
* (See the Console output for details!)