One way would be to that the companies interview you in your countries. This usually happens with on-campus recruitment.
Other way is that you are on some other visa (other than B-1), that does allows you to solicit, give interviews, etc. For example at the end of F-1 study visa, you can go around and shop for some time to get a job, and the company will then sponsor for your H1B.