chromium/content/test/data/accessibility/mac/selection/set-selection-contenteditable.html

<!--
@SCRIPT:
  // Select the 1st word via text marker associated with container AXGroup.
  text_range:= ce1.AXTextMarkerRangeForUIElement(ce1)
  marker_0:= text_range.anchor
  marker_1:= ce1.AXNextWordEndTextMarkerForTextMarker(marker_0)
  target_selected_marker_range:= ce1.AXTextMarkerRangeForUnorderedTextMarkers([marker_0, marker_1])
  ce1.AXSelectedTextMarkerRange = target_selected_marker_range
  wait for AXSelectedTextChanged on AXGroup
  ce1.AXSelectedText

@SCRIPT:
  // Select the 2nd word via the marker associated with AXStaticText.
  text:= ce1.AXChildren[0].AXChildren[0]
  text.AXValue
  text_range:= text.AXTextMarkerRangeForUIElement(text)
  marker_0:= text_range.anchor
  marker_1:= text.AXNextWordEndTextMarkerForTextMarker(marker_0)
  marker_2:= text.AXNextWordEndTextMarkerForTextMarker(marker_1)
  marker_3:= text.AXPreviousWordStartTextMarkerForTextMarker(marker_2)
  target_selected_marker_range:= text.AXTextMarkerRangeForUnorderedTextMarkers([marker_2, marker_3])
  ce1.AXSelectedTextMarkerRange = target_selected_marker_range
  wait for AXSelectedTextChanged on AXGroup
  ce1.AXSelectedText

@SCRIPT:
  // Select text inside a span.
  text:= ce1.AXChildren[0].AXChildren[3]
  text.AXValue
  text_range:= text.AXTextMarkerRangeForUIElement(text)
  marker_0:= text_range.anchor
  marker_1:= text_range.focus
  marker_2:= text.AXPreviousTextMarkerForTextMarker(marker_1)
  target_selected_marker_range:= text.AXTextMarkerRangeForUnorderedTextMarkers([marker_0, marker_2])
  ce1.AXSelectedTextMarkerRange = target_selected_marker_range
  wait for AXSelectedTextChanged on AXGroup
  ce1.AXSelectedText

@SCRIPT:
  // Select the text inside the block with incorrect grammar.
  text:= ce1.AXChildren[0].AXChildren[1].AXChildren[0]
  text.AXValue
  text_range:= text.AXTextMarkerRangeForUIElement(text)
  ce1.AXSelectedTextMarkerRange = text_range
  wait for AXSelectedTextChanged on AXGroup
  ce1.AXSelectedText

@SCRIPT:
  // Select the text after a forced break.
  text:= ce2.AXChildren[0].AXChildren[2]
  text.AXValue
  text_range:= text.AXTextMarkerRangeForUIElement(text)
  marker_0:= text_range.anchor
  marker_1:= text.AXNextWordEndTextMarkerForTextMarker(marker_0)
  target_selected_marker_range:= text.AXTextMarkerRangeForUnorderedTextMarkers([marker_0, marker_1])
  ce2.AXSelectedTextMarkerRange = target_selected_marker_range
  wait for AXSelectedTextChanged on AXGroup
  ce2.AXSelectedText
-->
<!DOCTYPE html>
<html>
<body>
  <div id="ce1" contenteditable="true">
    <p>The quick brown foxes <span aria-invalid="grammar">jumps</span> over the <em>lazy</em> dog</p>
  </div>
  <div id="ce2" contenteditable="true">
    <p><span>Pack my box</span><br><span>with five dozen liquor jugs.</span></p>
  </div>
</body>
</html>