The plasma thermodynamics in the solar upper atmosphere, particularly in the corona, are dominated by the magnetic field, which controls the flow and dissipation of energy. The relative lack of knowledge of the coronal vector magnetic field is a major handicap for progress in coronal physics. This makes the development of measurement methods of coronal magnetic fields a high priority in solar physics. The Hanle effect in the UV and IR spectral lines is a largely unexplored diagnostic. We use magnetohydrodynamic (MHD) simulations to study the magnitude of the signal to be expected for typical coronal magnetic fields for selected spectral lines in the UV and IR wavelength ranges, namely the H I Ly-$alpha$ and the He I 10830 {AA} lines. We show that the selected lines are useful for reliable diagnosis of coronal magnetic fields. The results show that the combination of polarization measurements of spectral lines with different sensitivities to the Hanle effect may be most appropriate for deducing coronal magnetic properties from future observations.