I always heard that an electron and other fermions behave like light and is neither a wave, neither a particle but still can behave like one of the two states. So how did they measure its mass?
You have forgotten or never noticed that the particle and wave duality depends on the boundary conditions of the experiment and the very small number h_bar, the Heisenberg uncertainty principle.
The track of an electron in the bubble chamber is a particle because its dp.dx uncertainty is well over the bounds of h_bar
If one knows the bending magnetic field mv^2=Bqv/r one can solve for the mass as as the charge is independently known.
When J.J. Thomson experimented with cathode rays in the 1890s, he measured the ratio of the electronʼs charge to its mass. He was unable to measure either value individually, because he needed to know the other one first. The charge of the electron was measured in the early 1900s by Robert Millikan, and then the electronʼs mass could be calculated.