You're supposed to click the potion matching the effect :)
The tubes at the top light up in a certain color, clicking the potion of that color will make you immune to the effect.The only effect "without" a real color is the black one, being a minigun.