This paper assesses the transient stability of a synchronous machine connected to an infinite bus through the notion of invariant sets. The problem of computing a conservative approximation of the maximal positive invariant set is formulated as a semi-definitive program based on occupation measures and Lasserre's relaxation. An extension of the proposed method into a robust formulation allows us to handle Taylor approximation errors for non-polynomial systems. Results show the potential of this approach to limit the use of extensive time domain simulations provided that scalability issues are addressed.