This Python script automates the process of checking the heading hierarchy of web pages using Safari's WebDriver. It reads URLs from a file, navigates to each page, checks the heading tags (h1, h2, h3, etc.) for logical order, and outputs the results to a CSV file.
- Python: The script is written in Python and requires Python to be installed on the user's system.
- Selenium: A web automation tool used to control Safari browser programmatically.
- Safari Browser: The script uses Safari's WebDriver, so a macOS with Safari installed is required.
If you don't have Python installed, download and install it from python.org. Ensure that Python is added to your PATH.
Install Selenium using pip. Open your terminal and run:
pip install selenium
Open Safari, go to "Safari" > "Preferences" > "Advanced" and enable the "Show Develop menu in menu bar" option. In the "Develop" menu, check "Allow Remote Automation".
Create a text file named marshall.txt and list the URLs to be checked, one per line.
Download script.py from this repository.
Open a terminal, navigate to the directory containing script.py and marshall.txt, and run:
python logic.py
Check the generated results.csv file for the heading hierarchy check results.
The script assumes web pages are accessible and load properly. It does not handle network issues or non-standard HTML structures that might affect heading detection. Currently, the script is designed to work only with Safari on macOS.
Contributions to enhance this script or to extend its compatibility with other browsers and operating systems are welcome.