A variac does not have variable frequency, setting the voltage accurately and stably might be challenging and advanced features like programming, arbitrary waveforms and much more are missing.
But if you just need to supply some AC voltage with mains frequency here and there, it should suffice.
You can look into AC power supplies like Chroma 61504/61604 but yeah, they are hugely expensive.