How can we fetch the page source in Selenium?

How can we fetch the page source in Selenium?

Hello Rhian-lewis,

Using the driver.getPageSource() command, we can fetch the page source in selenium. This method returns a string containing the page source.