htmltest

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package htmltest contains test helpers when working with the html package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrowserHelper

type BrowserHelper struct {
	*browser.Browser
	// contains filtered or unexported fields
}

func NewBrowserHelper

func NewBrowserHelper(t testing.TB, b *browser.Browser) BrowserHelper

func (BrowserHelper) OpenWindow

func (b BrowserHelper) OpenWindow(url string) WindowHelper

type HTMLDocumentHelper

type HTMLDocumentHelper struct {
	dom.Document
	// contains filtered or unexported fields
}

Helper type on top of html.HTMLDocument to provide useful helper functions for testing.

func NewHTMLDocumentHelper

func NewHTMLDocumentHelper(t testing.TB, doc dom.Document) HTMLDocumentHelper

func ParseHTMLDocumentHelper

func ParseHTMLDocumentHelper(t testing.TB, s string) (res HTMLDocumentHelper)

func (HTMLDocumentHelper) CreateHTMLElement

func (h HTMLDocumentHelper) CreateHTMLElement(tag string) html.HTMLElement

func (HTMLDocumentHelper) GetHTMLElementById

func (h HTMLDocumentHelper) GetHTMLElementById(id string) html.HTMLElement

GetHTMLElementById works as html/HTMLDocument.GetElementById but assumes the found element to be an html/HTMLElement

func (HTMLDocumentHelper) QuerySelectorHTML

func (h HTMLDocumentHelper) QuerySelectorHTML(pattern string) (res html.HTMLElement)

type HTMLElementHelper

type HTMLElementHelper struct {
	html.HTMLElement
	// contains filtered or unexported fields
}

func NewHTMLElementHelper

func NewHTMLElementHelper(t testing.TB, e html.HTMLElement) HTMLElementHelper

func (*HTMLElementHelper) AttributeValue

func (h *HTMLElementHelper) AttributeValue(key string) string

type HTMLHelper

type HTMLHelper struct {
	T testing.TB
}

func (HTMLHelper) CreateHTMLElement

func (h HTMLHelper) CreateHTMLElement(tagname string) HTMLElementHelper

Create a single HTMLElement for testing element behaviour.

func (HTMLHelper) NewDocument

func (h HTMLHelper) NewDocument() HTMLDocumentHelper

type WindowHelper

type WindowHelper struct {
	html.Window
	// contains filtered or unexported fields
}

Helper type on top of html.HTMLDocument to provide useful helper functions for testing.

func NewWindowHelper

func NewWindowHelper(t testing.TB, win html.Window) WindowHelper

func (WindowHelper) HTMLDocument

func (win WindowHelper) HTMLDocument() HTMLDocumentHelper

func (WindowHelper) MustEval added in v0.6.0

func (win WindowHelper) MustEval(script string) any

func (WindowHelper) MustLoadHTML added in v0.5.4

func (h WindowHelper) MustLoadHTML(html string)

func (WindowHelper) MustRun added in v0.6.0

func (win WindowHelper) MustRun(script string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL