I had a bass teacher early on that recorded about 4 notes onto a cassette, played very slowly and repeated several times. He then sort of coached me through guessing a note on the neck at random while he played it back and I would adjust higher or lower from there.
These days I mostly do the same thing, but after memorizing the line enough to hum it out loud or in my head. I can usually play most of not all of a song of mediumish difficultly (most popular rock songs) within a single playthrough, assuming the parts are straightforward and repetitious. More involved tunes might require a few playthroughs.
I will sometimes go to YouTube for really complicated stuff or when the bass part is harder to make out.