【问题标题】:how to use puppeteer click() with xpath, web testing如何将 puppeteer click() 与 xpath 一起使用,Web 测试
【发布时间】:2019-10-16 01:19:41
【问题描述】:

我正在尝试使用此代码单击元素:

test('no existed user try', async() => {
   await page.click($x('//*[contains (text(), "people")]'))
})

它返回一个错误$x is not a function

如何通过点击正确使用xpath?

【问题讨论】:

标签: xpath puppeteer


【解决方案1】:
 test('no existed user try', async() => {    
    const elements = await page.$x('//*[contains (text(), "people")]');
    await elements[0].click();
 });

【讨论】:

    猜你喜欢
    • 2021-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-06
    • 2020-02-01
    • 2018-11-27
    • 1970-01-01
    相关资源
    最近更新 更多