svenkreiss / html5validator

Command line tool to validate HTML5 files. Great for continuous integration.
MIT License
314 stars 34 forks source link

[Feature Request] Programmatic integration with Selenium Webdriver #117

Open frodeseverin opened 1 year ago

frodeseverin commented 1 year ago

I am waiting for PR #61 to be merged. This will enable better programmatic interface to validation in Python.

To further advance things, it would be nice to be able to validate HTML documents by passing a Selenium Webdriver object to the get_messages() function.

Use Case 1: I need to validate some web-applications while I am logged in to the application, and access the messages programmatically. Using Selenium in interactive mode I can easily log in to the webapp and run the validation on a speciffic page after navigating there.

Use Case 2: I need to correct minor errors in a webpage to see the effect it has on validation. Using Selenium in interactive mode coupled with the DevTools in the browser I can change the active document on the fly to correct errors and re-run tests.

Thoughts for a path forward: I suppose an easy way to do this would be to save the output from Selenium.page_source.encode() to a temporary file and then pass that file to get_messages() from PR #61

bemoody commented 1 year ago

From what I remember of how vnu.jar works, there may not be any better option than writing the source to a temporary file. Java is just... a pain.