0

I am trying to click on element with this code:

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

It returns me an error $x is not a function

how to use xpath correct with click ?

Md. Abu Taher
  • 17,395
  • 5
  • 49
  • 73
  • 3
    Possible duplicate of [How to use xpath in chrome headless+puppeteer evaluate()?](https://stackoverflow.com/questions/48448586/how-to-use-xpath-in-chrome-headlesspuppeteer-evaluate) – Md. Abu Taher May 30 '19 at 14:34

1 Answers1

0
 test('no existed user try', async() => {    
    const elements = await page.$x('//*[contains (text(), "people")]');
    await elements[0].click();
 });
Milan Rakos
  • 1,705
  • 17
  • 24