2003 Hyundai elantra stalls out while driving

Have a 2003 hyundai elantra has ran great until 2 weeks ago it cranks and fires go down the road and it bogs out and stalls it wont recrank until about 2 hours later thought it may be fuel pump replaced it replaced crankshaft. position senser.Still same problem wondering if anyone could give some insight to what else it could be before I pick it apart and waste money on sensers I may not need.

Your Check Engine Light isn’t illuminated?

Crankshaft position sensor maybe.

Yes check engine lights on
but its only pulling emission codes nothing to do with the problem its having

Replaced camshaft position sensor thought the same thing still same problem

CRANKshaft position sensor, not CAMshaft position sensor. They are not the same.

Yes replaced crankshaft postion sensor only one left is top dead center but no need to replace that one was thinking maybe idle control sensor

If the engine doesn’t crank (turn over), the starter motor is suspect - most likely, the solenoid contacts. If the engine cranks (turns over) but does not start, the problem is not in the starter motor, but in the fuel system or ignition system.

Please clarify. “Cranks ok but won’t start” means you hear that rrr rrr rrr sound with the key in start but it doesn’t catch and run. “Fails to crank” means you don’t even hear that rrr rrr rrr sound.

No it rrr rr it turn over but wont fire for several hours

Cranks ok but won’t start is usually caused by either no spark or no fuel. If you spray starter spray into the air intake will it start and run briefly before it stalls? If so, that’s a clue the problem is no fuel. The replacing-stuff-on-a-guess approach on newer cars like yours sometimes works, but it is also pretty easy to run out of money before running out of guesses. Suggest to focus on getting a correct diagnosis as the first objective.