It is safe to buy auto parts online as long as you buy the auto parts from a reputable auto parts website or places like Amazon or eBay.
I buy many auto parts online and it saves me lots of money.
If I don't need the auto part right away and can wait a few days or longer I will buy the auto part online and wait for it.
If I need an auto part right away I will go to the auto parts store and buy it even if it costs a bit more.
I buy auto parts online through eBay mostly and have never had any issue.
If I can't find the auto part on eBay I look on Amazon or rockauto.com
Most sellers on eBay and Amazon are legit sellers and will ship you the auto part when you buy it.
It's possible to get scammed even on eBay or Amazon if you don't buy from a legit seller.
Always check reviews of the seller and feedback before buying from eBay and you should be just fine.
If you don't get the item you can get your money back through eBay by filing and item not received message.