Open the potion bar, hover the mouse cursor over a potion and press a function key. The same can be done to select spells.