You could but it is not a surefire technique since you could trigger an GFCI device (Ground Fault Circuit Interruptor).
Moreover this could be really UNSAFE.
The fact is that whatever current you draw from the live wire it ends up to earth ground through the protective conductor (earth ground wiring system - green/yellow conductor).
This adds up to whatever leakage current is already present in the system. If the total leakage toward ground reaches the GFI trigger threshold (30mA usually) you have the whole system disconnected.
You really need a coil with an extremely low current to avoid that spurious trigger in any case.
This test is what is done by mains testers screwdrivers.
The safety problem comes because mains lines are subjected to voltage spikes that requires adequate safety countermeasures designed into whatever you connect to them. If, for example, your coil is connected to the mains when a 2000V spikes happens, the coil insulation could break down, giving rise to high-energy arcs, fires and explosions, if the coil is not designed with overvoltage protection in mind (a coil rated for 230V AC is not necessarily able to stand an overvoltage event on 230V mains).
This is the same problem you have with capacitors: you cannot place a generic 230VAC-rated capacitor across live and earth ground, you need a special Y-class rated capacitor which is guaranteed not to fail spectacularly during an overvoltage event.