I make a point of working out the bassline by ear as precisely as possible, even if I only play along to the record and don't play live. In fact, it's more important to get the notes right if you need to be in unison with the record than if you're playing a cover version with your band
As mentioned before, I listen to the song in question a number of times, sometimes sing along to it to tune myself to it, then grab my bass and make sure first of all to find what key it's in. That I do by playing a bit of the melody as I hear it, and checking whether it's correct. I often get it right first time, but sometimes it takes me several attempts.
Then I begin at the beginning, so to speak, and jot down chord charts if the song is easy to remember or write down the notes one by one as letters if it's tricky (I can read music but I can't write it correctly).
I tend to always play with my notes in front of me, which is something I would have to grow out of if I started to play live.