Some African parties and their leaders, even if (presently) not power, have attacked China though, on a broad populist message. E.g.
The leader of Patriotic Front Party (PFP) in Zambia, Michael Sata, effectively utilised anti-Chinese populist strategy in his presidential campaign. Part of the wedge
appeal was a vow to deport foreign investors and business owners, primarily
Chinese, if elected. Rehashing public discussions, Sata in his campaign messaging
portrayed Chinese investors as ‘exploiters’ of the country’s natural resource.
Besides, he branded Chinese as ‘infesters’, and accused Chinese companies of practising ‘slave labour’ and accordingly promised concerned constituents he would not
only undertake deportation of Chinese if elected but also initiate a fiscal regime
barring Chinese investors repatriating their income from the country.
[...] By riding on the anti-Chinese populist surge, Sata and the PFP won the presidency
in 2011.
But they lost it in 2021. (Sato died in office earlier, in 2014, but was succeeded by other presidents from PFP.) Zambia reportedly also has some the highest debt owed to China. I would not be surprised if the issue was also mentioned in those campaigns, but I can't point to specific statements. About three years ago, Zambia defaulted and its now in some kind of debt restructuring process, with Chinese participation. The opposition (UPND) guy who won the 2021 election reportedly was pushing for a 20% 'haircut' on the debt.
Hichilema, who has lost five previous elections, did not make the issue of Chinese debt as prominent as in previous campaigns and will need Beijing’s help in restructuring the country’s debt after a recent Eurobond default. [...]
In what was seen as a change of tune, in August that year [2021], Hichilema wrote to the Chinese embassy saying his United Party for National Development would “work hard to strengthen the friendship between our two nations” if it won the election.
However, he continued to warn that the country’s debts to China “had brought about major socio-economic problems.”
Which suggests that previously he campaigned on that issue, even if not using the Western 'debt trap' term.
And more recently in Kenya (2022):
Kenya’s new president, William Ruto, has signalled that the East African nation will still look to China to finance and develop its infrastructure – a U-turn from the antagonistic stance he struck during the campaign.
China is Kenya’s largest bilateral lender and has financed infrastructure projects from railways to highways. But during the presidential campaign, Chinese lending became a major political issue, with Ruto blaming those loans for Kenya’s debt troubles.
The rhetoric appears to get toned down or reversed once these African China-critics get to power though.
Also (from my first source), the playbook has been adopted by opposition elsewhere in Africa, even if not always successful in giving them power e.g.
From the playbook of Michael Sata of Zambia, the leader of Zimbabwe’s
Movement for Democratic Change Party (MDC), Nelson Chamisa, also adopted
anti-Chinese populist strategy as a wedge issue in the 2018 presidential campaign
platform. At the centre of Chamisa’s campaign was a vow to ‘expel’ Chinese
investors from Zimbabwe, and also cancel all perceived unfair bilateral agreements
signed involving China if elected as President. This was a remarkable turn of
event considering the long-cherished Zimbabwe–China ties. [...] In a
speech at a rally in the capital of Harare commemorating the 2018 May Day,
Chamisa declared:
I have seen the deals that ‘Ngwena’ [referring to President Mnangagwa] has entered
into with China and others, they are busily asset-stripping the resources of the country.
I have said beginning September when I assume office; I will call the Chinese and tell
them the deals they signed are unacceptable, and they should return to their country.
Chamisa failed to win that election, but he did score a respectable 45%.
Sometimes the criticism is directed at specific projects, e.g. in 2018:
[the] new president of Sierra Leone Julius Maada Bio canceled a Chinese-funded airport project signed by his predecessor, after referring to Chinese projects as “a sham” during a campaign debate.
And you might notice that some of this African criticism isn't directly purely at China (like much of the Western 'debt trap' talk is) but also takes aim at African leaders who agreed to those projects/terms.