First we have an automotive forum (AKA "The Garage") so you ought to contact a mod and ask them to move the topic to that subforum.
You're a little light on detail, for example which window? Were you using the switch on same door or on the driver's door (for a different window?) ?
Why would you buy both instead of first checking to see if power was getting to the switch, then to the motor, then if pulling the motor anyway, see if the motor spins when you give it external power?
SO, you see where power stops, and backtrack from there. One common fault that people overlook is if the power wire or ground is going through the door hinge boot and it has frayed apart from opening and closing the door so many times. That can result in it working one time, then open or close the door and it stops, and starts again, etc.
Is it possible that the window motor is spinning but the gears inside are a bit chewed up and only catch sometimes? You'd usually hear it if that's the case.