805
Views
8
Comments
How to get html code from a webpage

hi!

I need to get all the HTML code from a webpage that uses credentials.

For example, I want to get all HTML source code of a webpage like this:

https://nunogoncalopereira.outsystemscloud.com/MyApplication/Webscreen1.aspx

and this applications uses credentials such as in:

https://nunogoncalopereira.outsystemscloud.com/MyApplication/Login.aspx

I made code to get HTML code, but i have a problem, because the request fails on login.

How to do that? Could be in java, .net, C# code or JavaScript.

Thanks and Best Regards,

Nuno Pereira

UserImage.jpg
G Andrew Duthie
 
MVP

Is this required to be fully-automated?

That is, can the user log in first, and then save the output of the screen, or do you need to essentially 'script' the entire process of login and downloading the markup?

2020-03-24 00-01-07
Nuno Gonçalo Pereira

Hi Andrew!

I just need to get the HTML source code from a webpage or URL. Yes, the user can log in first and then extract the code.

UserImage.jpg
G Andrew Duthie
 
MVP

Sorry for the delayed response.

Additional questions: What is the purpose of getting the source? Is it going to be stored somewhere?

The reason I ask is to understand what you're trying to automate by using an app, as opposed to simply right-clicking the page and selecting "View page source".

2020-03-24 00-01-07
Nuno Gonçalo Pereira

Hi Andrew !

I just wanrt to learn how to get html code programatically and maybe using to do something automated to simplify some work of people, but do you know how to do it?

thanks and best regards,

Nuno Pereira


2019-01-04 10-45-45
Sravan Vanteru

Hi Nuno Gonçalo Pereira,

You can get html code by using HTTP service get simply for pages ( with anonymous ) , but I don't think you can login and get html in OutSystems, For you to work login (maintaining session)  and  getting html you need complete automation framework.


Work around :

Create API which does the login process and write HTTP get inside of API, get html code convert into string and return.


Hope this helps

Sravan


2020-03-24 00-01-07
Nuno Gonçalo Pereira

Sravan Vanteru wrote:

Hi Nuno Gonçalo Pereira,

You can get html code by using HTTP service get simply for pages ( with anonymous ) , but I don't think you can login and get html in OutSystems, For you to work login (maintaining session)  and  getting html you need complete automation framework.


Work around :

Create API which does the login process and write HTTP get inside of API, get html code convert into string and return.


Hope this helps

Sravan


Yes, this is what i've tried. I have an app, and inside an action i call an extension to get HTML code, but i have the problem that the HTML request code fails in login, even after the user to be logged in.

Thanks and Best Regards,

Nuno Pereira


2024-09-03 10-16-38
Prasath P

Hi,

I used HttpGet  but it working for .html pages only how to implement for outsystems pages

Thanks,

Prasath

UserImage.jpg
G Andrew Duthie
 
MVP

Might be worth looking into something like Selenium, to see if that would help:

https://success.outsystems.com/Documentation/Development_FAQs/How_to_do_UI_testing_with_Selenium

If nothing else, it might give you some additional ideas.

An additional question...do you control the site/screen from which you're trying to get the HTML?

Also, you haven't mentioned the "why". Why do you need to get the HTML? Perhaps there is another way to approach the problem that would be simpler, and get you to the same goal?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.