First, the page you linked to only says that Cavendish calculated the deflection of light, not measured it. Newton's law of gravity technically only applies to massive particles, as you say. But this business about light being massless came a hundred years later than Cavendish; in his time light was regarded as a wave, though Newton liked the idea of particles of light and called them "corpuscles".
The important point, though, is that since Galileo people had been aware that the acceleration due to gravity is independent of the object's mass. So it wouldn't have been a stretch to assume that whatever light is, it would be affected by gravity in exactly the same way as everything else, and Cavendish made his calculation based on this assumption.
The idea of light being bent by gravity therefore predates Einstein. General Relativity provides a more solid basis for this idea, but in practice the most important point is that the deflection it predicts is twice as large as the classical one. When Eddington measured the shift of a star during a solar eclipse, he wasn't only checking that light was deflected, he was also checking the actual formula predicted by GR.