Now that Democrats have taken control of the House, President Trump must show whether he can make good on his long-standing boast that he has perfected “the art of the deal” — this time with the opposition party that he has spent the last two years denigrating.

Despite the vitriol of the midterms, Trump and Democratic leaders have both signaled they are open to bipartisan cooperation.

Among the possible opportunities for common ground: a $1 trillion infrastructure plan, health care for people with preexisting conditions, controls on prescription drug prices, paid family leave — and possibly even providing a path to citizenship for immigrant children known as “dreamers,” analysts said.

“I think the president has proven that he’s interested in negotiating on a number of issues,” Rep. Conor Lamb (D-Pa.) saidon CNN Wednesday, adding that Trump “has talked a lot about prescription drugs recently, and infrastructure.”

“There is no reason at all that we shouldn’t be able to come to some kind of agreement,” he said.

Still, the scenario for continued gridlock remains strong. The animosity between Trump and Democratic leaders may be too great for them to trust one another. And the newly empowered Democrats are already planning to launch a ream of investigations into Trump and his administration, taking up the subpoena power that has been in the hands of the GOP for the last two years.

Trump struck a mixed tone about the Democrats Wednesday in morning tweets. He said that if House Democrats used their subpoena power to investigate him, “we will likewise be forced to consider investigating all of them.” But, after a campaign in which Republicans vilified Minority Leader Nancy Pelosi, he congratulated her, saying she “deserves to be chosen Speaker.”

Dan Glickman, a Democratic former U.S. representative from Kansas and former secretary of agriculture who runs a congressional program at the nonpartisan Aspen Institute, said he hoped an influx of younger party members will spur an impulse “to get things done, with less stock in the gridlock of the past.”

“I don’t think those people are going to be satisfied with the status quo,” he said.

The strongest prospect for cooperation could be a bipartisan infrastructure bill. Rep. Peter A. DeFazio (D-Ore.) has said he met last month with a senior White House official to discuss his own infrastructure plan.

Meanwhile, Democratic leaders have put forward a $1 trillion proposal that would be financed in part by raising taxes cut in the Republican tax bill.

While Trump is unlikely to agree to reverse his tax bill, he has said he wants to find a way to pass legislation to rebuild roads, bridges and other transportation facilities.

Pelosi, who is seeking to regain her post as House speaker, said in an interview Tuesday with the “PBS NewsHour” that passing an infrastructure bill is possible.

“The president has said that that is something he wants to do. It’s always been nonpartisan, always been nonpartisan. Hopefully, we can work together to advance that agenda,” she said.

Trump’s daughter, Ivanka, could play a role in reaching across the aisle by stepping up her advocacy for measures with potential Democratic support. Last year, she convinced her father to support expanding a child-care tax credit, a measure that was included in a tax bill approved by Republicans.

Similarly, Ivanka Trump has expressed support for a federal family leave plan that would give new parents six weeks of paid leave.

The proposal has languished. But family leave is overwhelmingly favored by Democrats and also has wide support among Republicans.

However, the two parties are far apart on how to finance such a measure. Some Republicans have suggested allowing parents to take Social Security benefits early as a way of paying for the leave, while agreeing to defer retirement benefits. Some Democrats blasted the idea as a raid on Social Security benefits, suggesting instead that the measure be funded by a new payroll tax.

Carrie Lukas, the president of the Independent Women’s Forum, a conservative group that spoke positively about the Republican proposal, expressed doubt that the parties will agree on a family leave policy given the “poisonous” political atmosphere and disagreement about how to pay for the plan.

“It would be a question of whether Democrats see this as something where they want to find common ground, or if their goal is just to thwart the White House,” Lukas said.

Another area of potential agreement could be an effort to lower prescription drug prices. Trump proposed last month that Medicare buy drugs at the lower prices available in some other countries — a savings that would be passed on to consumers.

“We are taking aim at the global freeloading that forces American consumers to subsidize lower prices in foreign countries through higher prices in our country,” Trump said.

Rep. Cheri Bustos (D-Ill.), co-chair of the House Democratic Policy & Communications Committee, said that lowering the cost of prescription drugs is a priority for her party. She said Democrats want to “stop outrageous prescription drug prices going up at a level that’s not sustainable,” enforce against price gouging, and allow Medicare to negotiate for drug prices.

There also could be grounds for compromise on protecting people with preexisting conditions, a key component of the health-care law known as Obamacare. While Trump has said he wants to repeal Obamacare, he has said he favors requiring insurance companies to cover people with preexisting conditions. He has not made clear how he would do that, and the debate over broader health-care legislation may begin anew.

Trump has also, at times, said he wants to protect the immigrant “dreamers” in a deal that would provide funding for a border wall, which has drawn support from some Democrats.

Hanging over the House is the question of whether Democrats pursue an effort to impeach Trump. It is possible that a report by the special counsel, Robert S. Mueller III, could be delivered to Congress that makes the case for impeachment. That is what happened in 1998, when then-Independent Counsel Ken Starr sent a report to Congress that laid out the grounds for impeachment, written in part by Brett M. Kavanaugh, who then was a Starr aide and now is Trump’s pick on the Supreme Court.

With his legacy and reelection at stake, Trump could either court Democrats or continue to vilify them — or do both. He is, after all, a man who has changed his party registration seven times, signing up as a Democrat and member of the Reform Party.

Democrats may question whether they can trust Trump if he offers them a deal.

“The problem is, this is a president who contradicts himself,” said Mickey Edwards, a Republican former U.S. representative from Oklahoma and author of “The Parties Versus the People: How to Turn Republicans and Democrats into Americans.” “You never know if he means what he says or if he says it for the cheers he gets at the moment.”

The margin by which Democrats won control of the House could also affect whether deals will be made. As of midmorning Wednesday, the party held a 220-193 advantage, with 22 races to be called.

The closer the margin, the more members will be “looking only at positioning their parties for the 2020 elections,” Edwards said. While he said that some Democrats will try to find bipartisan consensus, others will say of Republicans, “they kicked us, we’ll kick them.”

Jason Grumet, the founder and president of the Bipartisan Policy Center, said that history has shown the potential for cooperation.

“Congress used to have the capacity to metabolize the aggression inherent in any democracy and still get things done,” he said. “It’s not, ‘Can we all get along?’ It’s the dignity of having those fights and working together.”