I just sit down with the recording, listen closely, and try to find the notes. Over the years, I've always done it the same way, and looking back, I think there are a couple key things I do that help.
First, I have always done it with my electric unplugged, in a very quiet room, with the song volume very low so I can hear my unplugged electric at the same time with the recording. Because after listening, and poking around, you want to try to play along where you can to see if it sounds right.
I think this point is important, because I couldn't imaging a noisy amp and then a loud recording and trying to listen closely. Plus the amp will have tonal qualities and/or effects which will really make it sound different. What you're striving for is to hear the true notes under the artists effects, and you learn to ignore the effects and see how it matches the notes your playing.
Secondly, it's so important to be precisely in tune. So when you find a note - hopefully one that sustains a while that you can tune to... or a steady bass line... you play along and see if you're in tune. Often the recording is slightly higher or lower... like 'in-between' 2 frets. If you slightly bend the string you can hear it go in tune. So then you ever so slightly tune that string to match up.
Common sense also comes into play. For example if the note is between A and Bb for example, and you learn to recognize the sound of the open strings, you may be able to hear and verify that it is in the key of A as it is an open A string and not Bb. So you tune A EXACTLY with the recording. Then you want to do the same of other strings, and keep refining your tuning of the whole guitar, until you are well in tune with the recording. Once you are, it makes finding the notes SO much easier.
Thirdly, find other notes coming through in the chords. At least determine if they are major or minor chords. After you have the chords, you can see the notes in the scale - the key of the song - which just comes from playing the notes that make up the chords. So then as you try to find the lead guitar parts you will go straight to the notes that are in the scale, and it will help you find them much faster.
These are just a few tips to learning guitar solos by ear that I hope you may find helpful.