How to account for total gas fees

I know that the total transaction price will be the gas consumed * current gas price but how do I find out how much gas it will take for that transaction? Furthermore usually contracts include approvals before actually being able to lend, borrow, and swap. So it may only say you pay 50 cents for approval then you get jacked another 1.50 to actually initiate the trade not including other fees and slippage. I can’t fathom how arbitrage bots are able to make money with so much “uncertainty”.
submitted by /u/Elegant-Ad2911
[link] [comments]