We present two new techniques exploiting a Hartmann-Shack wavefront sensor to characterize the optical self-focusing effect of nonlinear materials. We demonstrate that the defocus Zernike coefficient (C5) can be used to quantify nonlinear optical properties of materials. In the first technique proposed, the wavefront of a collimated laser beam transmitted through a nonlinear sample is analyzed with different irradiance values. In the second technique,instead of conventional detectors, a Hartmann- Shack sensor is used in a Z-scan setup. The methods are demonstrated by measuring the nonlinear refractive indices of CS2 and Quartz, using femtosecond Ti:sapphire lasers at 76 MHz and 1 KHz repetition rate.