Fixed HTML tests in the case that lxml is not available as a backend

This fixes test failures when BeautifulSoup reverts to the standard library HTML parser instead of lxml, as @taldcroft noted in the discussion of #2812.