Elastic electron scattering using the finite element method. Forward and inverse problems