title: Applescript : Javascript to click in safari with unknown id
body: <p>How can I click in the "detailed" button listed bellow ?</p>
  
  <pre><code>&lt;span data-segment-id="bererf44b-be45-4514-922a-0fff0585gb"&gt;
      &lt;input type="radio" id="dccd7242-38d2-4f54-4841-73c4b48a2f56-view-selector-bererf44b-be45-4514-922a-0fff0585gb" name="dccd7242-38d2-4f54-4841-73c4b48a2f56-view-selector" value="detailed"&gt;
      &lt;label for="dccd7242-38d2-4f54-4841-73c4b48a2f56-view-selector-bererf44b-be45-4514-922a-0fff0585gb"&gt;Detailed&lt;/label&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>This work but I have to enter manually the encrypted id</p>
  
  <pre><code>tell application "Safari Technology Preview" to ¬
      do JavaScript ¬
          "document.querySelectorAll(\"[for=\\\"dccd7242-38d2-4f54-4841-73c4b48a2f56-view-selector-bererf44b-be45-4514-922a-0fff0585gb\\\"]\")[0].click();" in current tab of window 1
  </code></pre>
  
  <p>UPDATE :</p>
  
  <p>Most of the HTML is dynamic, and I can't very relie on it.</p>
  
  <pre><code>&lt;div class="center"&gt;
              &lt;div class="segmented-control view-selector component" id="THIS_IS_DYNAMIC"&gt;
      &lt;input type="radio" id="THIS_IS_DYNAMIC" name="THIS_IS_DYNAMIC" value="basic"&gt;
      &lt;label for="THIS_IS_DYNAMIC"&gt;Basic&lt;/label&gt;
  &lt;/span&gt;&lt;span data-segment-id="THIS_IS_DYNAMIC"&gt;
      &lt;input type="radio" id="THIS_IS_DYNAMIC" name="THIS_IS_DYNAMIC" value="detailed"&gt;
      &lt;label for="THIS_IS_DYNAMIC"&gt;Detailed&lt;/label&gt;
  &lt;/span&gt;&lt;/div&gt;
          &lt;/div&gt;
  </code></pre>