Skip to content

I.getPageTitle()

Returns the title of the current page.

Usage

js
I.getPageTitle()

Returns

A string containing the title of the current page.

Example

js
// Visit a news site
I.goTo("https://breakingnews.com")

// Click on the first article
I.click(".topstories-gallery > a:nth-child(1)")

// Get the page title
var title = I.getPageTitle()

// Log the page title to the test report
TEST.log.info("Article title: " + title)

This example navigates to a website, opens an article, retrieves the page title using I.getPageTitle(), and logs the title to the test report.