Home > other >  Pyppeteer problem, click the button in your web page or label, jump to the new open label, how to ge
Pyppeteer problem, click the button in your web page or label, jump to the new open label, how to ge

Time:10-02

In pyppeteer, in A page after clicking on A button or label, waiting to pop up A new page B, when B page opens, the first time for page B object, which can obtain to B page elements, excuse me what method can achieve that? Or what functions can be realized, seek guidance, thank you!!!!!
Eg:
Async def main () :
Print (' main ')
Width, height=1800, 900,
Browser=await launch (
{" headless ": False, 'userDataDir: r" \ "temporary," args ": [f' - Windows - size={width}, {height} '], 'dumpio: True,
'autoClose: False})
Page=await the brought ()
Await page. SetViewport ({' width: the width, 'height: height})
Await page. Goto (' http://news.baidu.com/')
Await page. WaitForSelector (' # pane - news & gt; Div & gt; Ul & gt; Li. Hdline3 & gt; Strong & gt; A ', # 300000} {' timeout ':)
Await asyncio. Gather (
Page. Click (' # pane - news & gt; Div & gt; Ul & gt; Li. Hdline3 & gt; Strong & gt; A '),
Page. WaitForNavigation ({' waitUntil ':' load ', 'timeout' : 0})
)
Url=await page. Url ()
Print (url)
Print (" AAA ")

If __name__=="__main__ ':
Asyncio. Get_event_loop (.) run_until_complete (the main ())

In this example, probably how to get to the last open pages in the first time the object? Behind 3 behavior what I this code and also can't perform to print out the url and AAA, thank you
  • Related