The sound of the Foley artist’s work was captured by a microphone while the artist watched the routine. I know that in later years, they watched a recording of the performance, but I’m not sure if in earlier years, they watched the performance live or did it later. At any rate, the microphone was used to capture the sounds of tapping.
I read an anecdote that after Gene Kelly‘s performance of the title song from “Singin’ in the Rain,” Gwen Verdon and Shirley McClaine performed the Foley work for him by tapping in buckets with a couple of inches of water in them! It’s possible, I suppose. ?