Dishwasher Trips breaker

My Kenmore dishwasher kept tripping its’ breaker. I removed the bottom
kick plate and reset the breaker. I turned on the dishwasher and there was a charge and spark and the breaker was again tripped. I looked inside and noticed wires that have burn marks. One wire is white w/ red, the other white w/ black. The wires attach to what looks, to me, to be a capacitor. There are two of these and the screw holding them both in place seems to run through to the inside of the machine where the top of the screw helps hold the heating element in place.

I have not been able to track down this “capacitor” looking part. It seems that the wires are okay. Would I just be looking for this part, or is something else going on?

…I have pulled one of two thermostats out and it seems pretty corroded.
One wire is blackened, so I’m wondering if this can simply be attached to a new thermostat, or if I have some electrical work to do? My model number is 665 1578581. The thermostat part number is 303652…I get a number of options…which is the one I want? Thanks for your help…in advance.