WebPagetest Forums
Need help clicking innerHTML - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Discuss Test Results (/forumdisplay.php?fid=4)
+--- Thread: Need help clicking innerHTML (/showthread.php?tid=15832)



Need help clicking innerHTML - Microsoft-Test - 07-13-2019 08:08 AM

Hi All,

I have a button like this in my html file as following:
<a class="Header signIn" data-m='{"N":"Sign":"1", "pT":"D"}'>Log In </a>

How do I click on it using webpagetest:

I tried innerHTML property like so:

navigate mywebsite.com
clickandWait innerHTML=Sign In

This doesn't seem to be working. Im getting the log in modal but the click is not happening.

Thanks!


RE: Need help clicking innerHTML - andydavies - 07-16-2019 07:01 PM

Your text on the link in "Log In" but your innerHTML refers to "Sign In", is this the issue?

I tend to use execAndWait for clicks that involve browser activity as a response, for example

execAndWait document.querySelectorAll("a")[0].click()

You'll need to change the selector to target the correct element but that's something you can test in browser devtools making it much easier to debug