The 29-year-old beauty faced stiff competition from fellow actresses Judy Greer, Jessica Biel and funnywoman Sarah Silverman for the part of magician's assistant Jane, reported Contactmusic.
"It was a bit of a coup getting this role - it was intended for a comedian. My agent knew I loved comedy, but I was a long shot, the lame horse at the back," she said.
Steve Carell, who is co-producing the movie, said Wilde blew casting directors away with her performance. "Her audition was fantastic. Subtle, but full of detail. She was my immediate first choice," he said.
Ooh La Lana! WWE Diva flaunts sexy curves in these 30 pictures
Photos: Salman Khan returns from Jodhpur to Mumbai
15 'peach' perfect photos of Priyanka Chopra at People's Choice Awards 2017
62 going on 16: These photos of Rekha prove she is 'forever young'
Spotted: Alia Bhatt, Ranveer Singh, Neha Dhupia in Bandra