Pair of Solenoids on a L298N and Elegoo UNO R3

Another thought: I've never used a 298 for solenoids, only 2x motors, and in the case of motors one uses "both channels"of the 298, one per motor. That needs 4x wires, a H/L or L/H on each side.

Looks to me that you have both solenoids on one channel, with one side of the solenoids grounded, and each relying on a H output to energise one solenoid or the other.

I suppose that should work, although I'd have gone for using both sides, and explicitly controlling both sides of each solenoid.

Also if your 9V battery is a PP3 smoke alarm battery, they have neither the current not the capacity for what you're doing.