driver

package
v0.0.0-...-e3a65fc Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const JsActiveElement = `
		document.activeElement.setAttribute('data-sailfoot-active-element', '');
		return 1;
		`
View Source
const JsActiveElementReset = `document.querySelector('[data-sailfoot-empty]').removeAttribute('data-sailfoot-active-element');`
View Source
const JsClickClosest = `` /* 608-byte string literal not displayed */
View Source
const JsClickWithText = `` /* 595-byte string literal not displayed */
View Source
const JsHasText = `
	var containsText = document.body.innerText.includes(text);
	return containsText ? 1 : 0;
`
View Source
const JsInputEmpty = `` /* 353-byte string literal not displayed */
View Source
const JsInputEmptyReset = `document.querySelector('input[data-sailfoot-empty]').removeAttribute('data-sailfoot-empty');`
View Source
const JsSelectEmpty = `` /* 275-byte string literal not displayed */
View Source
const JsSelectEmptyReset = `document.querySelector('input[data-sailfoot-empty]').removeAttribute('data-sailfoot-empty');`

Variables

View Source
var WEBDRIVER_KEYCODES = map[string]string{
	"NullKey":       string('\ue000'),
	"CancelKey":     string('\ue001'),
	"HelpKey":       string('\ue002'),
	"BackspaceKey":  string('\ue003'),
	"TabKey":        string('\ue004'),
	"ClearKey":      string('\ue005'),
	"ReturnKey":     string('\ue006'),
	"EnterKey":      string('\ue007'),
	"ShiftKey":      string('\ue008'),
	"ControlKey":    string('\ue009'),
	"AltKey":        string('\ue00a'),
	"PauseKey":      string('\ue00b'),
	"EscapeKey":     string('\ue00c'),
	"SpaceKey":      string('\ue00d'),
	"PageUpKey":     string('\ue00e'),
	"PageDownKey":   string('\ue00f'),
	"EndKey":        string('\ue010'),
	"HomeKey":       string('\ue011'),
	"LeftArrowKey":  string('\ue012'),
	"UpArrowKey":    string('\ue013'),
	"RightArrowKey": string('\ue014'),
	"DownArrowKey":  string('\ue015'),
	"InsertKey":     string('\ue016'),
	"DeleteKey":     string('\ue017'),
	"SemicolonKey":  string('\ue018'),
	"EqualsKey":     string('\ue019'),
	"Numpad0Key":    string('\ue01a'),
	"Numpad1Key":    string('\ue01b'),
	"Numpad2Key":    string('\ue01c'),
	"Numpad3Key":    string('\ue01d'),
	"Numpad4Key":    string('\ue01e'),
	"Numpad5Key":    string('\ue01f'),
	"Numpad6Key":    string('\ue020'),
	"Numpad7Key":    string('\ue021'),
	"Numpad8Key":    string('\ue022'),
	"Numpad9Key":    string('\ue023'),
	"MultiplyKey":   string('\ue024'),
	"AddKey":        string('\ue025'),
	"SeparatorKey":  string('\ue026'),
	"SubstractKey":  string('\ue027'),
	"DecimalKey":    string('\ue028'),
	"DivideKey":     string('\ue029'),
	"F1Key":         string('\ue031'),
	"F2Key":         string('\ue032'),
	"F3Key":         string('\ue033'),
	"F4Key":         string('\ue034'),
	"F5Key":         string('\ue035'),
	"F6Key":         string('\ue036'),
	"F7Key":         string('\ue037'),
	"F8Key":         string('\ue038'),
	"F9Key":         string('\ue039'),
	"F10Key":        string('\ue03a'),
	"F11Key":        string('\ue03b'),
	"F12Key":        string('\ue03c'),
	"MetaKey":       string('\ue03d'),
}

WEBDRIVER_KEYCODES defines common keycodes. You can use the keyword SendKey to send them, eg. "SendKey EnterKey".

Functions

This section is empty.

Types

type FakeDriver

type FakeDriver struct {
}

func (*FakeDriver) Check

func (w *FakeDriver) Check(selector string) bool

func (*FakeDriver) Click

func (f *FakeDriver) Click(is_xpath bool, arg string) bool

func (*FakeDriver) ClickClosestTo

func (w *FakeDriver) ClickClosestTo(selector1 string, selector2 string) bool

func (*FakeDriver) ClickNth

func (w *FakeDriver) ClickNth(arg string, nth int) bool

func (*FakeDriver) ClickOnText

func (w *FakeDriver) ClickOnText(selector string, text string) bool

func (*FakeDriver) ExecuteJavascript

func (w *FakeDriver) ExecuteJavascript(jsString string) bool

func (*FakeDriver) GoToNthWindow

func (f *FakeDriver) GoToNthWindow(arg int) bool

func (*FakeDriver) HasText

func (f *FakeDriver) HasText(arg string, arg2 string) bool

func (*FakeDriver) Input

func (f *FakeDriver) Input(is_xpath bool, arg string, text string) bool

func (*FakeDriver) InputEmpty

func (w *FakeDriver) InputEmpty(text string) bool

func (*FakeDriver) Log

func (f *FakeDriver) Log(arg string) bool

func (*FakeDriver) Navigate

func (f *FakeDriver) Navigate(arg string) bool

func (*FakeDriver) NewPage

func (f *FakeDriver) NewPage(arg string) bool

func (*FakeDriver) Read

func (f *FakeDriver) Read(arg string) (string, bool)

func (*FakeDriver) Select

func (w *FakeDriver) Select(selector string, text string) bool

func (*FakeDriver) SelectEmpty

func (w *FakeDriver) SelectEmpty(text string) bool

func (*FakeDriver) SendKey

func (w *FakeDriver) SendKey(keycode string) bool

func (*FakeDriver) Start

func (f *FakeDriver) Start()

func (*FakeDriver) Stop

func (f *FakeDriver) Stop()

func (*FakeDriver) WindowSize

func (w *FakeDriver) WindowSize(width, height int) bool

type TestDriver

type TestDriver interface {
	Start()
	Stop()
	Click(bool, string) bool
	ClickNth(string, int) bool
	ClickClosestTo(string, string) bool
	Navigate(string) bool
	NewPage(string) bool
	GoToNthWindow(int) bool
	HasText(string, string) bool
	Input(bool, string, string) bool
	InputEmpty(string) bool
	Select(string, string) bool
	SelectEmpty(string) bool
	Check(string) bool
	Log(string) bool
	Read(string) (string, bool)
	ExecuteJavascript(string) bool
	ClickOnText(string, string) bool
	SendKey(string) bool
	WindowSize(int, int) bool
}

TestDriver is and interface that exposes all browser functionality. Current implementing classes: FakeDriver, WebDriver (written with Agouti)

type WebDriver

type WebDriver struct {
	// contains filtered or unexported fields
}

func (*WebDriver) Check

func (w *WebDriver) Check(arg string) bool

func (*WebDriver) Click

func (w *WebDriver) Click(is_xpath bool, arg string) bool

func (*WebDriver) ClickClosestTo

func (w *WebDriver) ClickClosestTo(selector1 string, selector2 string) bool

func (*WebDriver) ClickNth

func (w *WebDriver) ClickNth(arg string, nth int) bool

func (*WebDriver) ClickOnText

func (w *WebDriver) ClickOnText(selector string, text string) bool

func (*WebDriver) ExecuteJavascript

func (w *WebDriver) ExecuteJavascript(jsString string) bool

func (*WebDriver) GoToNthWindow

func (w *WebDriver) GoToNthWindow(nth int) bool

func (*WebDriver) HasText

func (w *WebDriver) HasText(arg string, arg2 string) bool

func (*WebDriver) Init

func (w *WebDriver) Init(driverType *string)

func (*WebDriver) Input

func (w *WebDriver) Input(is_xpath bool, arg string, text string) bool

func (*WebDriver) InputEmpty

func (w *WebDriver) InputEmpty(text string) bool

func (*WebDriver) Log

func (w *WebDriver) Log(arg string) bool

func (*WebDriver) Navigate

func (w *WebDriver) Navigate(arg string) bool

func (*WebDriver) NewPage

func (w *WebDriver) NewPage(arg string) bool

func (*WebDriver) Read

func (w *WebDriver) Read(arg string) (string, bool)

func (*WebDriver) Select

func (w *WebDriver) Select(arg string, text string) bool

func (*WebDriver) SelectEmpty

func (w *WebDriver) SelectEmpty(text string) bool

func (*WebDriver) SendKey

func (w *WebDriver) SendKey(keycode string) bool

func (*WebDriver) Start

func (w *WebDriver) Start()

func (*WebDriver) Stop

func (w *WebDriver) Stop()

func (*WebDriver) WindowSize

func (w *WebDriver) WindowSize(width, height int) bool

WindowSize resizes the browser window to width x height.

Jump to

Keyboard shortcuts

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