我正在使用Apify 的 puppeteer登录这个网站。我确实研究了类似的问题,但无济于事。
我无法找到链接登录页面上看到的主登录按钮的可点击 ID/元素。目前,我的代码如下所示:
const Apify = require('apify');
Apify.main(async () => {
const input = await Apify.getValue('INPUT');
const browser = await Apify.launchPuppeteer();
const page = await browser.newPage();
await page.goto('https://www.sunpass.com/vector/account/home/accountLogin.do');
// Login
await page.type('#tt_username1', input.username);
await page.type('#tt_loginPassword1', input.password);
await page.waitFor(2000);
await page.click('#entryform input');
await page.waitForNavigation();
// Get cookies
const cookies = await page.cookies();
// Use cookies in other tab or browser
const page2 = await browser.newPage();
await page2.setCookie(...cookies);
await page2.goto('https://www.sunpass.com/vector/account/transactions/webtransactionSearch.do'); // Opens page as logged user
await browser.close();
console.log('Done.');
使用 identryform
我收到以下错误:Node is either not visible or not an HTMLElement
使用 idloginP
我收到以下错误:No node found for selector
我使用 XPath 来定位这些,它没有提供其他使用的 id。任何有关如何为此登录按钮或任何其他方法查找可点击元素的帮助将不胜感激。