Tesla-XSAN FRANCISCO — In a challenge to its self-driving car technology, Tesla Motors on Wednesday was hit with a lawsuit by class action heavyweight Hagens Berman Sobol Shapiro alleging that the automaker sold nearly 50,000 cars with defective autopilot software and knowingly put drivers in harm’s way.

“Contrary to what Tesla represented to them, buyers of affected vehicles have become beta testers of half-baked software that renders Tesla vehicles dangerous if engaged,” states the complaint filed in federal court in San Jose, California. The three named plaintiffs say they spent between $81,000 and $113,000 on their vehicles, and describe white-knuckle experience using their cars’ autopilot features.