Is it possible to get existing page source and save it to a string in Selenium?

Is it possible to get existing page source and save it to a string in Selenium?

Hi Brett,

You can use Browser command getPageSource() to get the source code of existing page. getPageSource() method gets the existing page source and return a String output. You can use following command to get the page source:

String Page_Source = driver.getPageSource();