Water pump works from the minute I press the main switch
I may have had the same problem. At the end of a normal wash cycle the pump would stay on for hours or even days - I would have to power off, and then keepp trying to power on until it had eventually stopped. The pump operates even with the door open.
Problem is caused by a small float which senses the water level in the dishwasher, floating up and operating a microswitch, which turns on the pump to pump the water out. Obviously, if the dishwashe is filling up for some reason, you want the pump to operate even if the door is open. The float is in a small chamber - a very snug fit, with a hole in the bottom which is connected to the main pipework in the machine. There is another chamber next to the flot chamber which is also connected to the pipework. When the water level rises too high, water from this second chamber overflows into the flot chamber, raising the float and operating the pump. The water level then drops as the water is pumped out. The water level in the float chamber should also drop, but didn't on my dishwasher because the hole in the bottom was blocked (with old soap suds and grime I assume). Hence the pump just stays on. I assume in my case, the water flowed out very slowly, and eventually the pump stopped.
To fix it, removed the left hand side panel (2 screws on the front door lip. The back of the panel is just hooked on some raised bits of plastic). This exposes all the pipework, and the red float can be seen in it's chamber. I removed an extra couple of bits of plastic near the float chamber whilst I tried to work out what to do - but this may not be necessary. You will have to try for yourself. I couldn't get access to the hole to poke something in to unblock it, so I poured sink and drain cleaner into the flot chamber, topping up as it drained away, leaving it for approx. 15 mins. I think thick bleach would also work. Note: this cleaner won't be very good for any metal inside the dishwasher, so run 1 or 2 wash cycles to clean it out.
Maybe the dishwasher cleaner advertised on tv would have worked i.e. the stuff you put in the dishwasher on an emty cycle to clean out all the internals. I haven't used it, but it would be easier than taking the dishwasher to pieces.
Hope this helps