A stability criterion for solitons of the driven nonlinear Schrödinger equation (NLSE) has been conjectured. The criterion states that p (v) < 0 is a sufficient condition for instability, while p (v) > 0 is a necessary condition for stability; here, v is the soliton velocity and p = P /N, where P and N are the soliton momentum and norm, respectively. To date, the curve p(v) was calculated approximately by a collective coordinate theory, and the criterion was confirmed by simulations. The goal of this paper is to calculate p(v) exactly for several classes and cases of the generalized NLSE: a soliton moving in a real potential, in particular a time-dependent ramp potential, and a time-dependent confining quadratic potential, where the nonlinearity in the NLSE also has a time-dependent coefficient. Moreover, we investigate a logarithmic and a cubic NLSE with a time-independent quadratic potential well. In the latter case, there is a bisoliton solution that consists of two solitons with asymmetric shapes, forming a bound state in which the shapes and the separation distance oscillate. Finally, we consider a cubic NLSE with parametric driving. In all cases, the p(v) curve is calculated either analytically or numerically, and the stability criterion is confirmed.