K
K
kopelev20002019-02-02 20:24:45
Python
kopelev2000, 2019-02-02 20:24:45

What could be the problem in parsing a multi-page site?

In general, what is the problem.
When parsing, it throws an error:
5c55d137b12fd358592041.png
But the fact is that the script works fine up to a certain point.
For example, you need to collect information from 1000 pages, the error only works on 100+ pages, on a smaller scale (about 100 pages, on page 8), what could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Eremin, 2019-02-04
@kopelev2000

The problem is that the element is no longer on the page. It's in the driver's memory, but it's not in the DOM anymore.
So when the driver gets the command to access the element, it's OK until it starts looking for it in the browser.
The second similar scenario would be to recreate the element. If suddenly the element was recreated on the page for some reason, it already has a different ID, and the driver does not know about it.
I did not see your code, but I suspect you are writing the element to a variable and then accessing it. Which, in fact, from the point of view of programming, is correct.
The way out is simple: do not save to a variable. Look for the element every time anew and immediately perform the desired action.

browser.find_element_by_id("your_element_id").click()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question