【发布时间】:2020-11-04 05:31:48
【问题描述】:
我正在尝试将链接连接到此 href
<a href="http://e epurl.com/g-em6v" title="Late Night 1 Love" target="_blank">Late Night 1 Love</a>
(我必须在 url 之间添加空格) 我能够通过以下方法获取文本内容
const [el] = await page.$x('//*[@id="archive-list"]/div/li[1]');
const txt = await el.getProperty("textContent");
const rawTxt = await txt.jsonValue();
const [link] = await page.$x('//*[@id="archive-list"]/div/li[1]/a');
const L = await string('//*[@id="archive-list"]/div/li[1]/a/@href');
console.log(L);
我无法提取链接本身,我希望这会起作用,但似乎并不那么简单。
我正在使用 Puppeteer 访问页面以访问元素。
【问题讨论】:
-
console.log(L);的输出是什么?