Whirlpool washer won't fill with water

Our washing machine will not fill with water. Once and a while it will but not consistently. Also when it does fill during the wash cycle it won’t in the rinse cycle. We checked the hose and it is clear. We also replaced the water level switch part #3366848. It worked right through one full cycle and now will not work again. Any further suggestions would be helpful