I know that you can easily do this with the Selenium IDE.

But I would like to be able to export the test script programmatically. That is, to convert this

to that

by doing something like:
seleniumIDE_API.export(htmlFilePath, outputPath, OutputTypes.CSHARP_NUNIT_WEBDRIVER);
The reason I want to is to reduce the number of steps that need to be taken when creating tests. So, all you have to do is create a test and take out the html file in some directory.
selenium selenium-ide
user2102611
source share