Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

i want to print html page source in output. In selenium IDE there is a command to perform this action.

storeHtmlSource

How to do the same in Selenium Webdriver(Java)?

While exporting the testcase, It shows the following error.

// ERROR: Caught exception [ERROR: Unsupported command [getHtmlSource |  | ]]
share|improve this question

2 Answers 2

Using Selenium WebDriver:

WebDriver driver = new ChromeDriver();
driver.get("your Url here");
String htmlSource = driver.getPageSource();
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.