If you don't have lots of snails, then usually people put a smooth surface glass bottle with some food inside to attract them, which crab can climb in but no way out. However, if you have lots of snails, then they usually eat all food first and get out ;-(
Maybe others have better way...