Alternatively, you can turn to the Headless Platform and use the built-in mechanism:
Window.MouseMove(Point point, MouseButton button, RawInputModifiers modifiers)
Window.KeyPress(Key key, RawInputModifiers modifiers, PhysicalKey physicalKey, string? keySymbol)