All templates
Web AutomationBeginner
Take Screenshot of a Web Page
Robomotion•Updated 6 months ago

Overview
Opens a URL in a browser and saves a screenshot of the rendered page to disk.
Take Screenshot of a Web Page
Taking screenshots is a valuable ability in web flows, as users can store and share the current state of a web page. A typical scenario where screenshots are needed is logging. Robomotion provides a dedicated node to take screenshots of whole web pages or specific web elements.
What Take Screenshot of a Web Page can do
- Input Dialog titled
Take screenshot of a website, messagePlease provide the website address to take screenshot of.., defaultrobomotion.io->msg.url_input. - Normalise input (
Core.Programming.Function,outputs: 2) — cancel short-circuits toCore.Flow.Stop; otherwise trim, prependhttps://if missing, store asmsg.url. - Build paths (
Core.Programming.Function) —msg.desktop_path = global.get('$Home$') + '\Desktop',msg.screenshot_path = msg.desktop_path + '\ScreenShot.png', initialisemsg.retry_count = 0. - Launch browser (
Core.Browser.Open,chrome, maximised) ->msg.browser_id, open the URL (Core.Browser.OpenLink, timeout 60) ->msg.page_id. - Take screenshot (
Core.Browser.Screenshot) saving tomsg.screenshot_path, thenCore.Browser.Closeonmsg.browser_id. - Timestamp via
Robomotion.DateTime.Now(RFC3339, Local) ->msg.now, formatted (Robomotion.DateTime.Format, layout2006-01-02@03-04) ->msg.stamp. - Rename (
Core.FileSystem.Move,continueOnError: true) tomsg.renamed_path = msg.desktop_path + '\ScreenShot-' + msg.stamp + '.png', thenCore.Dialog.MessageBoxtitledScreenshot taken!showingmsg.dialog_text. Core.Trigger.Catcharound the launch/open pair — incrementsmsg.retry_count, sleeps 2s, andCore.Flow.GoToback to the retry label; after one retry it stops withfailed.
Behind the scenes
- Screenshot filename format
ScreenShot-yyyy-MM-dd@hh-mm.png— the@between date and time is deliberate so timestamps sort cleanly without colliding with filesystem separators. Core.Browser.Screenshotcaptures the rendered page via thepage_id, so the maximised browser window determines the viewport before the shot is taken.