And again Good Colleagues. Here is a piece of code: it reads from the url file and goes through it further. How to add the ability to verify that the page is correct?

driver = webdriver.Chrome() driver.maximize_window() f = open(r"404.txt", 'w', encoding='utf8') for url in line: try: driver.get(url) except WebDriverException: print("Incorrect URL: {}".format(url)) write_to_file(r"404.txt", "Incorrect URL: " + url) if driver.find_elements_by_xpath(er_xpath): print('404: {}'.format(url)) write_to_file(r"404.txt", "Ошибка 404: " + url) continue driver.quit() 
  • After all, selenium cannot return the http status, so you checked the contents of the page driver.find_elements_by_xpath(er_xpath) ? What is the question? - gil9red
  • How is it determined if the page is correct? - Enikeyschik

0