2017-06-04 1 views

Répondre

0

C'était le code qui fait l'affaire. J'ai eu des problèmes ne pas l'enregistrer. Je ne sais pas pourquoi, mais j'ai réalisé qu'il pourrait y avoir des cas où je veux quand même enregistrer le document existant.

var untitledWindow = app.windows["Untitled"] 
    if untitledWindow.exists { 
     untitledWindow.typeKey("w", modifierFlags:.command) 
     //untitledWindow.buttons[XCUIIdentifierCloseWindow].click() should work too 
     if untitledWindow.buttons["Save"].exists{ 
      untitledWindow.buttons["Save"].click() 
     } 
     if untitledWindow.buttons["Replace"].exists { 
      untitledWindow.buttons["Replace"].click() 
     } 
    }