From which place Selenium Webdriver gets title - using driver.title

200 Views Asked by At

From which place Selenium Webdriver usually gets title - using driver.title ?

  • from Page Source
  • or from DOM structure
1

There are 1 best solutions below

0
On

title

title returns the title of the current page.

  • Usage:

    title = driver.title
    
  • Defination:

    def title(self):
    """Returns the title of the current page.
    
    :Usage:
        title = driver.title
    """
    resp = self.execute(Command.GET_TITLE)
    
  • Details: When you invoke driver.title the HTTP GET request is invoked through the /session/{session id}/title URI Template.

NOTE: This command returns the document title of the current top-level browsing context, equivalent to calling document.title.

  • The remote end steps are:
    • If the current top-level browsing context is no longer open, return error with error code no such window.
    • Handle any user prompts and return its value if it is an error.
    • Let title be the result of calling the algorithm for getting the title attribute of the current top-level browsing context's active document.
    • Return success with data title.