We develop a new and general method to prove the existence of the random attractor (strong attractor) for the primitive equations (PEs) of large-scale ocean and atmosphere dynamics under non-periodic boundary conditions and driven by infinite-dimensional additive fractional Wiener processes. In contrast to our new method, the common method, compact Sobolev embedding theorem, is to obtain the time-uniform a priori estimates in some Sobolev space whose regularity is higher than the solution space. But this method can not be applied to the 3D stochastic PEs with the non-periodic boundary conditions. Therefore, the existence of universal attractor (weak attractor) was established in previous works (see [15,16]). The main idea of our method is that we first derive that P-almost surely the solution operator of stochastic PEs is compact. Then we construct a compact absorbing set by virtue of the compact property of the solution operator and the existence of a absorbing set. We should point out that our method has some advantages over the common method of using compact Sobolev embedding theorem, i.e., using our method we only need to obtain time-uniform a priori estimates in the solution space to prove the existence of random attractor for the corresponding stochastic system, while the common method need to establish time-uniform a priori estimates in a more regular functional space than the solution space. Take the stochastic PEs for example, as the unique strong solution to the stochastic PEs belongs to C([0,T];(H1(℧))3), in view of our method, we only need to obtain the time-uniform a priori estimates in the solution space (H1(℧))3 to prove the existence of random attractor for this stochastic system, while the common method need to establish time-uniform a priori estimates for the solution in the functional space (H2(℧))3. However, time-uniform a priori estimates in (H2(℧))3 for the solution to stochastic PEs are too difficult to be established. The present work provides a general way for proving the existence of random attractor for common classes of dissipative stochastic partial differential equations driven by Wiener noises, fractional noises and even jump noises. In a forth coming paper, using this new method we [46] prove the existence of random attractor for the stochastic nematic liquid crystals equations. This is the first result about the long-time behavior of stochastic nematic liquid crystals equations.