Voici la balise HTML du bouton sur lequel j'aimerais cliquer à l'aide d'AppleScript.
<button class="btn btn-primary" autofocus="" ng-click="ok()" tabindex="0"><!-- ngIf: !isTranslate --><span ng-if="!isTranslate" class="ng-scope">OK</span><!-- end ngIf: !isTranslate --> <!-- ngIf: isTranslate --></button
Voici mon script.
tell application "Google Chrome"
tell tab 2 of window 1 to set clickOnMyButton to execute javascript "document.getElementsByClassName('ng-scope')[0].click();"
end tell
Résultat :
valeur manquante
Comment générer un clic ?
Mise à jour : j'ai découvert que c'est la cause du blocage
style="z-index: 1050; display: block;"
Bloc HTML complet
<div tabindex="-1" role="dialog" class="modal fade ng-isolate-scope in" ng-class="{in: animate}" ng-style="{'z-index': 1050 + index*10, display: 'block'}" ng-click="close($event)" modal-window="" size="sm" index="0" animate="animate" style="z-index: 1050; display: block;">
<div class="modal-dialog modal-sm" ng-class="{'modal-sm': size == 'sm', 'modal-lg': size == 'lg'}"><div class="modal-content" modal-transclude=""><div class="modal-header ng-scope"><span class="information-icon glyphicon glyphicon-info-sign"></span> <!-- ngIf: !isTranslate --><span class="information-header ng-scope" ng-if="!isTranslate">Information</span><!-- end ngIf: !isTranslate --> <!-- ngIf: isTranslate --></div><div class="ng-scope"><span class="glyphicon modal-body glyphicon-menu-down" ng-class="{ 'glyphicon-menu-down' : !errorDetails, 'glyphicon-menu-right' : errorDetails}" ng-click="errorDetails = !errorDetails" tabindex="0"></span><!-- ngIf: !isTranslate --><span ng-if="!isTranslate" class="ng-scope">Details</span><!-- end ngIf: !isTranslate --> <!-- ngIf: isTranslate --></div><!-- ngIf: !errorBullets --><div ng-if="!errorBullets" collapse="errorDetails" class="ng-scope collapse in" style="height: auto;"><ul><li class="ng-binding">Please provide Purchase data</li></ul></div><!-- end ngIf: !errorBullets --><!-- ngIf: errorBullets --><div class="modal-footer ng-scope"><button class="btn btn-primary" autofocus="" ng-click="ok()" tabindex="0"><!-- ngIf: !isTranslate --><span ng-if="!isTranslate" class="ng-scope">OK</span><!-- end ngIf: !isTranslate --> <!-- ngIf: isTranslate --></button></div></div></div>
</div>
Si je ne peux pas cliquer sur le menu, comment puis-je le supprimer à l'aide d'AppleScript ?