I have a question about Python selenium

Asked 2 years ago, Updated 2 years ago, 39 views

Python Selenium created a function that parses web data (Google headless mode).

When I checked the print, it was self.Add driver.get_screenshot_as_file('1.png') to take a screenshot and parse it.

It works fine.

It's the same code, but if you don't add screenshots, you can't parse it. Does anyone know why?

python selenium

2022-09-22 12:44

1 Answers

The time the snapshot function (get_screenshot_as_file) completes It's probably because the page you're trying to crawl takes longer than the time it takes to load all the pages.

It's similar to the effect of sleeping().

The target page is probably a page that receives data asynchronously after loading, and additional HTML elements are created and distributed with the received data. If you approach this asynchronous operation before it's complete, you can't parse it.


2022-09-22 12:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.