Originally posted by Ulrich
View Post
Announcement
Collapse
No announcement yet.
How to get a value from a web page and convert it to a string in AMS
Collapse
X
-
-
Load the HTML into a XML, and use the built-in actions to read the elements as you need.
Code:-- load the HTML from string or via HTTP actions local sHTML = [[<!DOCTYPE html> <html lang="en"> <head> </head> <body> <h2>Layout</h2> <p>In this example, we have created a header, two columns/boxes and a footer. On smaller screens, the columns will stack on top of each other.</p> <p>Resize the browser window to see the responsive effect.</p> </body> </html>]]; -- set the XML from loaded HTML XML.SetXML(sHTML); -- extract desired information local sH2Element = XML.GetValue("html/body/h2"); Dialog.Message("Info", sH2Element);
- Likes 1
Leave a comment:
-
How to get a value from a web page and convert it to a string in AMS
Hi for my case can I get the value of a h2 title from a website to have it in a variable?
For example, a web that is structured as follows, how would you capture that word Layout
Code:<!DOCTYPE html> <html lang="en"> <head> </head> <body> <h2>Layout</h2> <p>In this example, we have created a header, two columns/boxes and a footer. On smaller screens, the columns will stack on top of each other.</p> <p>Resize the browser window to see the responsive effect.</p> </body> </html>
Tags: None
Leave a comment: