Auto Resource Resolution

There are some situations where you can't render your content through a browser. You're usually just left with a raw HTML string coming from a standard GET request. In cases like these, Selectify can render your content for you so you can debug pages and selectors visually.

Booting up a browser takes a meaningful amount of CPU, memory, and time to render all the interactive elements. If you're using a constrained environment or if execution speed is of the highest importance, you may prefer to use a curl, fetch (node), or requests (python) to resolve the raw HTML directly.

Selectify supports this use-case through Auto Resource Resolution. All you have to do is upload the raw HTML content and we'll take care of the rest. In the background, we'll detect the dependent files that your page needs to render properly and fetch them with our crawlers. Right now this includes stylesheets, fonts, and images. We'll then render a fully responsive webpage for you to view in the Console.

Example

In this example, we fetch a page known to contain rich external formatting in the form of CSS files and images. On upload we indicate that we want the server to resolve these resources on our behalf, with the auto_resolve_resources flag.

Automatic resolution using Node

import { Session, createPageState, getSelector } from '@selectify/client';

const url = "https://www.iana.org/numbers";
const html = await (await fetch(url)).text()

const session = new Session({ workflowName: 'YOUR_PROJECT'});
await session.start();

// Upload the content and let the server resolve the rich media
const pageState = await createPageState({
    session,
    url,
    html,
    autoResolveResources: true,
})
console.log("Created page state", pageState)

Script success

$ npm run pipeline.js

Created page state { id: 40, url: 'https://www.iana.org/numbers', sessionId: 20 }

Once the page is uploaded and the server fetches the dependencies, you should see a full rendering of the page. The logo and map graphics have both been cached on Selectify, so even if the page changes in the future, this archive will stay the same. Click around the rendered view to inspect elements.

Auto Resource Resolution