Republicans arriving in Cleveland next month to nominate Donald J. Trump will be greeted by as many as 6,000 protesters on the first day, a noisy coalition of dozens of groups, including Black Lives Matter and the Workers World Party. The demonstrators intend to ignore restrictions keeping them far from the delegates, raising fears the violence that accompanied some of Mr. Trump’s rallies will be magnified on a mass scale.

Two marches along routes the city has not authorized are planned for the convention’s opening day, July 18. Organizers say they want to avoid violence. But they are also gearing up for confrontation with the police, including training in civil disobedience.

“If there are people willing to put themselves on the line to be arrested, so be it,” said Deb Kline, a leader of Cleveland Jobs With Justice, one of the groups that will march.

A week later, as Democrats pour into Philadelphia, so will an army of Bernie Sanders supporters planning Occupy Wall Street-style protests against what they call the “fraudulent” nomination of Hillary Clinton. One group, Occupy DNC Convention, is circulating information about protecting oneself from tear gas by wearing a vinegar-soaked bandanna and swim goggles.