Take a potshot at (someone or something)

To criticize someone or something.

The mayor of the city decided to take a potshot at his opponent in the election.