Yes, you can travel but you need to return before the start date of your H1B. This will make the process easy and less stressful. My advice is not verified by law so you can take this as information than decision.For example; you have OPT now and working at some place. You have already filed for H1B this year and you need to travel outside US. It will be advisable that you come before October 1st as most probably that will be your start date for H1B.You need to inform your employer and carry proper dicumentation while travelling. This will help you in supporting your case in case of any issues. Also, check with your employer if any new rules have been implemented recently.Good Luck.