This process of creation of HTML pages using python is similar to process of creation of any other file. To automatically open the pages after execution, we will use selenium webdriver. Following are the steps: 1. Open any text editor and create a python file with .py extension. 2. Import selenium packages. (Make sure you download them first.) For downloading on Ubuntu, use these commands in terminal: $ sudo apt-get install python-pip $ sudo pip install selenium Import: from selenium import webdriver 3. Write the following to create HTML file on execution. f = open ( ' helloworld.html ' , ' w ' ) 4. In order to write in this file, use the following code: f.write( """ <!DOCTYPE HTML> < html > < header > < title > This is title </ title > </ header > < body > Hello world </ body > </ html > """) 5. Close command : f.close() 6. Use the
This blog has got a few solutions to common problems beginners face. Hope it helps you find yours. More posts coming soon...