Method: Selenium::Client::Idiomatic#text

Defined in:
lib/selenium/client/idiomatic.rb

#text(locator) ⇒ Object Also known as: text_content

Return the text content of an HTML element (rendered text shown to the user). Works for any HTML element that contains text.

This command uses either the textContent (Mozilla-like browsers) or the innerText (IE-like browsers) of the element, which is the rendered text shown to the user.

  • ‘locator’ is an Selenium element locator



19
20
21
# File 'lib/selenium/client/idiomatic.rb', line 19

def text(locator)
  string_command "getText", [locator,]
end