Get HMTL code of a website


is there some way how to store all the html code of a certain website into some text variable?

e.g. storing all the HTML source code of webpage www, to a string variable “Web_string”

htmlString.xaml (5.5 KB)


How would we do it if it was a secure website?

It will work with both…check it out with

or one more way by using HttpWebRequest and StreamReader also you can get the html of the provided url but Webclient class to simplify your work.


1 Like

Hi Aksh.

Is there any way that i can extract the same via DOM explorer or something similar?

Did not get it… sorry… but DOM libraries will mostly available for server side scripting languages and if same thing you are getting with webclient then why you are not using it?

This solution is very cool, and I will definitely be keeping it in mind.

I find however that it’s unable to deal with some URLs… for example Microsoft support docs, such as “”. It doesn’t crash or anything, the RPA simply vanishes into the ozone attempting to execute the Webclient.DownloadString on those URLs.

At least in our shop. I suspect it has something to do with security certificates (to be able access those URLs via IE… though not FF or Chrome… we have to add the domain to Trusted Sites) or something to do with the fact that those particular URLs are redirects. For example, URL “” will redirect to “”.

So it’s not solving my particular problem this afternoon. Definitely a technique to keep in mind though.

If anyone has any insight into what goes on here, we could sure use some enlightenment!

Have you tried replacing “WriteLine” with “Write Text file”? I think WriteLine has character limit which is probably holding up the process.

The issue’s not with outputting the retrieved HTML string, it’s getting the string in the first place. The ‘failure’ occurs at the webClient.DownloadString(“”) step.

Try this way

htmlString.xaml (7.9 KB)

1 Like

Hey everyone,

@vvaidya I am trying to extend this and search the source code for a string (variable or URL) and then write the results to a csv file.

For example, I want to be able to read the source code at; see if the code contains “” and then write the value to a csv file.


How do I supply username and password to a secure site using your htmlString example?

1 Like