1. const target = browser.waitForTarget 获取跳转页面
    2. const newPage = await target.page() 获取跳转页面的控制权
    1. const puppeteer = require("puppeteer");
    2. const url = "http://www.kuwo.cn/";
    3. (async () => {
    4. const browser = await puppeteer.launch({
    5. headless:false,
    6. defaultViewport: null, //可视区域最大化
    7. });
    8. const page = await browser.newPage();
    9. await page.goto(url)
    10. var a2 = await page.$(".sub_nav a:nth-child(2)");
    11. await a2.click()
    12. const target = await browser.waitForTarget(t=>t.url().includes("rankList"));
    13. const newPage = await target.page();
    14. var res = await newPage.$eval(".btns .play span",ele=>ele.innerHTML);
    15. console.log(res)
    16. })();