WHITE PLAINS, N.Y. — Kerry Kennedy says she did not knowingly take a sleeping pill and get behind the wheel of a car.

Kennedy testified Wednesday in her drugged-driving trial in New York that she thought she had taken her thyroid medication but must have taken a sleeping pill by mistake.

Kennedy was charged after her Lexus swerved into a tractor-trailer on a highway in 2012. Blood tests detected the sleeping drug.

Kennedy says she has taken the thyroid medication every day since 1991. She says she takes the sleeping pills to adjust to the time change when she travels.

Defense lawyer Gerald Lefcourt showed the jury a photograph of the two similar-looking pill bottles.

He showed another photo of the two different pills. Both were light-colored and oblong, but one was slightly longer than the other.

The prosecution argues that even if she took the sleeping pill accidentally, Kennedy violated the law by failing to pull over when it took effect.

Kennedy said the sleeping pills were on the counter on the morning of the accident because she was planning a trip.

Kennedy, 54, is the ex-wife of New York Gov. Andrew Cuomo, the daughter of Robert F. Kennedy and the niece of the late President John F. Kennedy.

Lefcourt asked her about her background and her work as president of the Robert F. Kennedy Center for Justice and Human Rights

Justice Robert Neary cut them off, saying, “I’m not sure this is the right forum to go into exhaustive detail.”