Skip to content
Advertisement

Tag: puppeteer

How to click on element with text in Puppeteer

Is there any method (didn’t find in API) or solution to click on element with text? For example I have html: And I want to click on element in which text is wrapped (click on button inside .elements), like: Answer Short answer This XPath expression will query a button which contains the text “Button text”: To also respect the <div

Wait for text to appear when using Puppeteer

I wonder if there’s a similar way as in Selenium to wait for text to appear for a particular element. I’ve tried something like this, but it doesn’t seem to wait: Answer You can use waitForFunction. See https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitforfunctionpagefunction-options-args Including @elena’s solution for completeness of the answer:

How to use Puppeteer and Headless Chrome with Cucumber-js

I am trying to do BDD with cucumber-js and drive the browser testing with Headless Chrome and puppeteer. Using the documentation from cucumber node example and headless chrome, I get the following errors, the entire code base is avaliable here: github repo. Errors: TypeError: this.browser.newPage is not a function TypeError: this.browser.close is not a function // features/support/world.js // features/step_definitions/hooks.js //

Advertisement