Announcement

Collapse
No announcement yet.

How to get a value from a web page and convert it to a string in AMS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • judanamu2
    replied
    Originally posted by Ulrich View Post
    Load the HTML into a XML, and use the built-in actions to read the elements as you need.

    Ulrich
    Hello, thanks for answering but I mean to get it from the URL. Not loading the HTML manually, something like HTTP.Submit

    Leave a comment:


  • Ulrich
    replied
    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);
    Ulrich

    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>


Working...
X