Method: Osascript::Safari.document_text

Defined in:
lib/osascript/Safari.rb

.document_textObject

+options tab (for instance : options = ‘tab 2 of window 1’).

Returns:

  • the text displayed of front document or of the



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/osascript/Safari.rb', line 69

def document_text
  options ||= {}
  where = options[:where] || 'front document'
  code = <<~CODE
  if count of window is 0
    return null
  else
    return text of (#{where})
  end
  CODE
  Osascript::__asrun(code, 'Safari')
end