Is there any way to validate the ePub file using selenium webdriver?


epubcheck will assess whether your file conforms to the epub standards. It doesn't care about your content or your formatting, as long as it conforms to the epub standards.

An epub file mostly a static web site compressed into zip format (plus some additional metadata). So:

  • You could unzip the content in a directory and use Selenium to examine the HTML pages.
  • Some of the epub metadata files are XML-based (e.g. the NCX and OPF files). You might be able to use Selenium to examine some of those. I haven't used Selenium to validate XML stuff that isn't HTML, so I can't comment on its helpfulness there. epubcheck does a thorough job of validating the structure of those but, again, not the content.

I don't have an opinion about whether this approach is worthwhile. But given that some of the content is plain old HTML, it is possible to check it with Selenium.


I haven't done this, but since epubcheck has a CLI & java library, you could incorporate the library with WebDriver & do the validation that way.

The wiki has an example of how to use it as a library.


No. Selenium WebDriver is a tool for operating a browser by remote control. It is not a tool validating ePub files.

It is conceivable that you could find a web-based tool for validating ePub files, and that you could operate that tool using Selenium WebDriver, but I would not recommend testing that way. If you need to validate an ePub file, I recommend finding a CLI that does the job.

Not the answer you're looking for? Browse other questions tagged or ask your own question.