WebpageTest Script clickAndWait not working as expected

I’d like to test the time to open an article (clicking a link from the homepage) once the homepage has loaded. I’ve used a script to do this and the results are not what I expect.

//	Open Homepage
setEventName	OpenHomePage
navigate	https://cravetime.com

//	Click on Article
setEventName	ClickOnArticle
clickAndWait	innerText=4 simple steps for rapid skill acquisition

Here are the results:

The filmstrip view ONLY shows the first page. I’d like to see the homepage loaded and then see the article loaded. This website (cravetime.com) loads pages using Javascript (similar to ReactJS) so I thought might cause strange results but trying a similar script on a server rendered site also results in the same issue.
WebPageTest - Running web page performance and optimization tests...

Any ideas on how I can get a multi-page filmstrip view?

Thank you

Not 100% sure why innerText isn’t working, but if I switch to using href it seems to work well:

//	Open Homepage
setEventName	OpenHomePage
navigate	https://cravetime.com
//	Click on Article
setEventName	ClickOnArticle
clickAndWait	href=/save-time/learning/rapid-skill-acquisition

Example: WebPageTest - Running web page performance and optimization tests...

I’ll dig on the innerText thing to see what’s up there.

Thank you Tim! That’s great.

I also tried using exec
exec document.querySelector("#node-77 > div > div > header > h2 > a").click();
but this too had the same result as the innerText. I know the JS selector works because I can paste it in the console and it succesfully clicks the link.

Anyway, you’ve given me solution the I need and I’m happy.

Really appreciate your work and also good to see your live performance audit yesterday on Twitch. I’m obsessed with getting links within a site to open instantly so would love to see a future episode on how to benchmark that - from page to page.

Thanks
David

I also tried using exec

You’ll need execAndWait there so that it waits until all browser activity has completed. Here’s a test using that selector but execAndWait subbed in for exec.

Generally, I dig execAndWait with a click over clickAndWait in most cases as it’s a bit easier to debug ahead of time in the console.

Really appreciate your work and also good to see your live performance audit yesterday on Twitch. I’m obsessed with getting links within a site to open instantly so would love to see a future episode on how to benchmark that - from page to page.

Glad it was useful! :slight_smile: Yeah, I think a future one focused on that page to page nav could be pretty interesting to do. Thanks for the idea.

1 Like

Thank you again Tim!