Whirlpool washer will not drain or spin. Is it the lid switch?

Washer will agitate but goes dead in any drain and spin cycles. Is it a defective lid switch

Thanks, I will try replacing switch