Clicking icons buttons and images

Sometimes we want to click on objects that simply pictures. But often you can find labels for them by hovering over them. We can use these labels to target the objects we want to click on.

Try the example below to see how this works:

// Let's click on the 'heart' icon on this tweet to like it.
I.goTo("https://twitter.com/PhillyPolice/status/1052371210384891904")
I.click("Like")I.see("Sign up for twitter")

If there aren't any tooltips on the icon buttons and images, you should speak to your developer to put it in, not just for the sake of testing, but to improve the usability of your application. As a last resort, you can still use CSS and XPATH selectors, but that's another lesson.

When you are ready, click Next below.