boundingBox();
>获取元素的位置信息
mouse.move()
# 核心api
var position = await ele.boundingBox(); //获取元素的位置信息
const puppeteer = require("puppeteer");
const url = "https://account.aliyun.com/register/register.html";
async function show () {
const browser = await puppeteer.launch({
headless:false,
defaultViewport: null, //可视区域最大化
});
const page = await browser.newPage();
await page.goto(url)
/* 切换iframe */
const frame = await page.$("#alibaba-register-box");
const html = await frame.contentFrame();
/*进度条 */
var span = await html.$(".nc-lang-cnt")
var span_info = await span.boundingBox();
await page.mouse.move(span_info.x,span_info.y);
await page.mouse.down();
for(var i=0;i<span_info.width;i++){
await page.mouse.move(span_info.x+i,span_info.y)
}
await page.mouse.up();
}
show()