Within Density Functional Theory, we have calculated the energy of the transitions from the ground state to the first two excited states in the electron bubbles in liquid helium at pressures from zero to about the solidification pressure. For $^4$He at low temperatures, our results are in very good agreement with infrared absorption experiments. Above a temperature of $sim 2$ K, we overestimate the energy of the $1s-1p$ transition. We attribute this to the break down of the Franck-Condon principle due to the presence of helium vapor inside the bubble. Our results indicate that the $1s-2p$ transition energies are sensitive not only to the size of the electron bubble, but also to its surface thickness. We also present results for the infrared transitions in the case of liquid $^3$He, for which we lack of experimental data.