For the most part, cockpit visits are at the captain's discretion, so it's all a function of how busy the pilots are, and what their comfort level is (especially with the pandemic); they may be willing to let you visit before the flight, after the flight, or not at all.