Skip to content
Advertisement

How to check if there is a picture on a website or not with Python and Selenium

I want to check with a boolean request, if there is a picture on the website:

https://portal.dnb.de/opac/mvb/cover?isbn=9783442472352

or not:

https://portal.dnb.de/opac/mvb/cover?isbn=3499239663

I don`t know how that is possible.

Thank you for your help!!

Advertisement

Answer

Looks like you should deal with response status – for selenium, take a read:

How to get status code by using selenium.py (python code)

Alternative approach, get the status with requests:

JavaScript

Output

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement