I am trying to parse banking website and I have the whole workflow recorded in Selenium and everything works. Due to inability to persist cookies between sessions while using Selenium Webdriver (Cookies cannot be loaded - "missing name exception") I moved to puppeteer. Line by line it went good until I got the following lines:
In selenium:
await driver.findElement(By.css(".buttons:nth-child(4)")).click()
and in puppeteer
await page.frames()[1].click('.buttons:nth-child(4)');
does not work.
What is funny though:
await page.frames()[1].waitForSelector('.buttons:nth-child(4)');
does not throw exception so element is present on the page.
page.frames() will return a promise. You have to await almost everything:
let frames = await page.frames()
await frames[1].click('.buttons:nth-child(4)');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.