Element Info & Attributes

Get Content and CSS

Builds a self-contained HTML document from the selected element by combining its outer HTML with extracted global and element-specific CSS inside a <style> block, then returns the complete HTML string.

Examples

GPAL Fluent: High-level fluent C# API

//This route is what PrintToPDF runs on: the element is exported as standalone HTML with the styles that make it look like itself, and that is what becomes the PDF. With no selector set the whole page is printed instead. There is no fluent call that hands the HTML back on its own; for that, the layers below.

browser.WithSelector(cardSelector).PrintToPDF(pdfFile);

MagicHelper: MagicHelper utility library

browser.MagicHelper.GetContentAndCss(string css);

browser.MagicHelper.GetContentAndCss(string xpath);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.GetContentAndCss(string css).Execute();

browser.PuppeteerClient.GetContentAndCss(string xpath).Execute();

Puppeteer Communicator: Low-level communicator

await browser.PuppeteerCommunicator.GetContentAndCss(string elementId, string sessionId);

REST Client: Direct REST/HTTP client

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.GetContentAndCss).WithCss(string css).Execute();

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.GetContentAndCss).WithXPath(string xpath).Execute();

💬 Ask GPAL