Believe me, corporations do not want to go through the h1b visa process, but the other choice is to leave those jobs vacant because there’s nobody else who can fill it.
Raise the salary and Americans will be lined up around the block for those jobs. We have good engineering programs here in the US, but kids don’t choose engineering as much as they used to because the pay is viewed as being not that great, layoffs are very likely, and yes, it is very difficult. Of course medical school is also very tough and yet there is never any shortage of applicants. What’s the difference? That’s right, it’s the salary and also, doctor’s jobs are viewed as being more secure (although that will probably change someday too).
This same argument is used to support illegal immigrant labor. Americans are too stupid|ignorant|lazy to pick strawberries, so we have to hire illegals. No, Americans simply refuse to do difficult manual labor under hazardous conditions for very little pay. As for engineering, Americans refuse to endure 4 years of a grueling undergraduate program so that, if they’re lucky, they can get an entry-level engineering position and then get axed in the first layoff.