1997 Honda Civic intermittently stalling

My 97 Honda Civic has been stalling intermittently. Sometimes when I’m turning the car on, sometimes at stoplights/signs, only once when the car was moving. It has always started back up either immediately or after waiting a few minutes. It mostly has been happening at night but happened a few times during the day too. I noticed two of the times happened at night while I was rolling down the window. I took it to a mechanic who said the battery wasn’t charging properly and I needed a new alternator, so I paid to have the alternator replaced. However, the problem has not gone away. I took it to a different mechanic who tested the battery, ignition, and alternator and said they all seemed fine. They couldn’t replicate the stalling issue in the shop (they tried driving it around, I told them to also try doing so with the lights on) and they said because they couldn’t see the stalling in action, they didn’t know what the issue was and couldn’t do anything for me. The car just stalled again today at a stop sign during the day so the issue is ongoing. I don’t know what to do next and advice is appreciated.

The stalling might be caused by a faulty crankshaft position sensor.

https://www.rockauto.com/en/catalog/honda,1997,civic,1.6l+l4,1168938,ignition,crankshaft+position+sensor,7196

If the computer loses the signal from this sensor, the computer see’s no reason to operate the ignition and fuel systems. And the engine shuts off.

Tester