The use of contrastive learning (CL) in recommendation has advanced significantly. Recently, some works use perturbations in the embedding space to obtain enhanced views of nodes. This makes the representation distribution of nodes more even and then improve recommendation effectiveness. In this article, the authors provide an explanation on the role of added noises in the embedding space from the perspective of invariant learning and feature selection. Guided by this thinking, the authors devise a more reasonable method for generating random noises and put forward web semantic based robust graph contrastive learning for recommendation via invariant learning, a novel graph CL-based recommendation model, named RobustGCL. RobustGCL, randomly zeros the values of certain dimensions in the noise vectors at a fixed ratio. In this way, RobustGCL can identify invariant and variant features and then learn invariant and variant representations. Tests on publicly available datasets show that our proposed approach can learn invariant representations and achieve better performance.