The primary elections in four states on Tuesday appeared to underscore Ms. Matthews’s assessment: There wasn’t just energetic voting by women, but also energetic voting for women. Nineteen Democratic congressional primaries had at least one woman on the ballot. Women won in all but three of the races. And in Ohio, Democrats nominated Rachel Crooks, a woman who has accused Mr. Trump of forcibly kissing her, for a seat in the State Legislature.

Jess O’Connell, a former top official at the Democratic National Committee and Emily’s List, the influential Democratic women’s group, said voters alarmed by the mistreatment of women might be likelier to embrace female candidates. She predicted those voters would mostly support Democrats, but allowed that sexual misconduct was a problem that crossed party lines.

“Women make up just over 20 percent of elected officeholders and men are nearly 100 percent of this problem,” Ms. O’Connell said. “I think this is pretty straightforward for women.”

Less straightforward, for Democrats, has been the experience of cleansing their own ranks as Mr. Trump heckles them from the West Wing. The party has pressured a succession of liberal men to resign amid a range of allegations, including Mr. Schneiderman, former Senator Al Franken of Minnesota and former Representative John Conyers Jr. of Michigan, who was the House’s longest-tenured member. Representative Ruben Kihuen of Nevada, a first-term Democrat, rejected calls to resign over harassment accusations but dropped his bid for a second term.

Republicans have nudged a number of lawmakers to quit, too, including Representatives Trent Franks of Arizona, Pat Meehan of Pennsylvania and Blake Farenthold of Texas. In almost every case, lawmakers in both parties first projected Trump-like defiance before relenting under pressure, after a period of weeks or months. (Mr. Schneiderman, facing some of the gravest allegations — choking and violently slapping women — lasted three hours.)

But Republicans acknowledge that Mr. Trump has encouraged a culture of permissiveness in the party when it comes to matters of sexual harassment and worse. The president campaigned for Roy S. Moore, an alleged child molester, who was defeated in a special election for the Senate in Alabama last year. Associates of Mr. Trump said at the time that he viewed Mr. Moore’s claims of innocence as a proxy for his own denials of wrongdoing.