Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the errors encountered in using pyppeteer

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to solve the errors encountered in using pyppeteer. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Errors encountered in using pyppeteer

Pyppeteer.errors.ElementHandleError: Error: failed to find element matching selector ".btn _ ok"

I used the following code: in order to detect whether the element exists, the program ends if it exists, or retries if it doesn't exist.

Btn_ok = await page.Jeval ('.btn _ ok',' node = > node.style')

Solution:

Btn_ok = await page.querySelector ('[class= "nc_iconfont btn_ok"]')

But after using this, when the sliding fails and the refresh of the sliding CAPTCHA is reproduced, the following error occurs.

Updated (2020-01-20):

The root cause of the misunderstanding is that you don't have permission to delete the user's browsing data when you close the browser await browser.close ().

Solution:

When defining the browser, the setting parameter 'userDataDir': renders:\ temporary', specifies a directory that the user can execute, and that's fine.

But in this way, it is equivalent to saving the user's browsing data.

You may encounter another error, after the event loop opens the browser, it is not executed, and the result is returned directly.

Take a look at the document and call createIncogniteBrowserContext () to open a seamless browser directly. That makes it much better.

When closing, you need to pay attention to separate closing, seamless closing, and normally open browsers also need to be closed.

Pyppeteer.errors.NetworkError: Protocol Error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.

Solution: this is due to a problem with the library itself. Problems with the pyppeteer library.

On how to solve the errors encountered in the use of pyppeteer to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report