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:
https://www.webpagetest.org/result/210527_AiDcA0_03b6857fe8b20e8f9c05b464014db35e/

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 Test Result - Dulles : www.drupal.org - 05/27/21 00:35:33

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 Test Result - Dulles : cravetime.com - 05/28/21 15:59:07

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.
https://webpagetest.org/result/210528_AiDcJK_60be0bd8b204a07cd9191e9d0eb1d9c6/

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.

https://webpagetest.org/result/210528_AiDc2F_ba3a8dfd062e770bd9e36e554e7fc43e/

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.

Thank you again Tim!