Get HTML Code

Gets the HTML code of a web page.

Command availability: IBM RPA SaaS and IBM RPA on premises


Gets the HTML code of the currently active tab in the web page.

Script syntax

IBM RPA's proprietary scripting language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

webGetHtmlSource (String)=value


Use the Start Browser (webStart) command to start a browser or use the Find Internet Explorer Browser (findBrowser) command to attach the Microsoft Internet Explorer before using Get HTML Code (webGetHtmlSource) command.

Output parameter

Designer mode label Script mode name Accepted variable types Description
HTML code value Text Returns text with the page's full HTML code.


Use the Start Browser (webStart) to start web manipulation, navigate to the IBM web page, then use the Get HTML Code (webGetHtmlSource) command to get the full HTML code from the IBM homepage.

defVar --name htmlCode --type String
webStart --name browser --type "Chrome"
webNavigate --url ""
webGetHtmlSource htmlCode=value
webClose --name browser
logMessage --message "${htmlCode}" --type "Info"
// Displays the HTML retrieved from the page and stored in ${htmlCode} in the console.