Ecco il tag HTML del pulsante su cui vorrei fare clic usando 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
Ecco il mio 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
Risultato:
missing value
come posso generare un clic?
Aggiornamento: ho scoperto che questo sta causando il blocco
style="z-index: 1050; display: block;"
Blocco HTML completo
<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>
Se non riesco a fare clic sul menu, come posso rimuoverlo utilizzando AppleScript?