repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
op/go-logging | logger.go | IsEnabledFor | func (l *Logger) IsEnabledFor(level Level) bool {
return defaultBackend.IsEnabledFor(level, l.Module)
} | go | func (l *Logger) IsEnabledFor(level Level) bool {
return defaultBackend.IsEnabledFor(level, l.Module)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"IsEnabledFor",
"(",
"level",
"Level",
")",
"bool",
"{",
"return",
"defaultBackend",
".",
"IsEnabledFor",
"(",
"level",
",",
"l",
".",
"Module",
")",
"\n",
"}"
] | // IsEnabledFor returns true if the logger is enabled for the given level. | [
"IsEnabledFor",
"returns",
"true",
"if",
"the",
"logger",
"is",
"enabled",
"for",
"the",
"given",
"level",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/logger.go#L139-L141 | test |
op/go-logging | logger.go | Criticalf | func (l *Logger) Criticalf(format string, args ...interface{}) {
l.log(CRITICAL, &format, args...)
} | go | func (l *Logger) Criticalf(format string, args ...interface{}) {
l.log(CRITICAL, &format, args...)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Criticalf",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"log",
"(",
"CRITICAL",
",",
"&",
"format",
",",
"args",
"...",
")",
"\n",
"}"
] | // Criticalf logs a message using CRITICAL as log level. | [
"Criticalf",
"logs",
"a",
"message",
"using",
"CRITICAL",
"as",
"log",
"level",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/logger.go#L203-L205 | test |
op/go-logging | logger.go | Warningf | func (l *Logger) Warningf(format string, args ...interface{}) {
l.log(WARNING, &format, args...)
} | go | func (l *Logger) Warningf(format string, args ...interface{}) {
l.log(WARNING, &format, args...)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Warningf",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"log",
"(",
"WARNING",
",",
"&",
"format",
",",
"args",
"...",
")",
"\n",
"}"
] | // Warningf logs a message using WARNING as log level. | [
"Warningf",
"logs",
"a",
"message",
"using",
"WARNING",
"as",
"log",
"level",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/logger.go#L223-L225 | test |
op/go-logging | logger.go | Noticef | func (l *Logger) Noticef(format string, args ...interface{}) {
l.log(NOTICE, &format, args...)
} | go | func (l *Logger) Noticef(format string, args ...interface{}) {
l.log(NOTICE, &format, args...)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Noticef",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"log",
"(",
"NOTICE",
",",
"&",
"format",
",",
"args",
"...",
")",
"\n",
"}"
] | // Noticef logs a message using NOTICE as log level. | [
"Noticef",
"logs",
"a",
"message",
"using",
"NOTICE",
"as",
"log",
"level",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/logger.go#L233-L235 | test |
op/go-logging | logger.go | Infof | func (l *Logger) Infof(format string, args ...interface{}) {
l.log(INFO, &format, args...)
} | go | func (l *Logger) Infof(format string, args ...interface{}) {
l.log(INFO, &format, args...)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Infof",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"log",
"(",
"INFO",
",",
"&",
"format",
",",
"args",
"...",
")",
"\n",
"}"
] | // Infof logs a message using INFO as log level. | [
"Infof",
"logs",
"a",
"message",
"using",
"INFO",
"as",
"log",
"level",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/logger.go#L243-L245 | test |
op/go-logging | format.go | SetFormatter | func SetFormatter(f Formatter) {
formatter.Lock()
defer formatter.Unlock()
formatter.def = f
} | go | func SetFormatter(f Formatter) {
formatter.Lock()
defer formatter.Unlock()
formatter.def = f
} | [
"func",
"SetFormatter",
"(",
"f",
"Formatter",
")",
"{",
"formatter",
".",
"Lock",
"(",
")",
"\n",
"defer",
"formatter",
".",
"Unlock",
"(",
")",
"\n",
"formatter",
".",
"def",
"=",
"f",
"\n",
"}"
] | // SetFormatter sets the default formatter for all new backends. A backend will
// fetch this value once it is needed to format a record. Note that backends
// will cache the formatter after the first point. For now, make sure to set
// the formatter before logging. | [
"SetFormatter",
"sets",
"the",
"default",
"formatter",
"for",
"all",
"new",
"backends",
".",
"A",
"backend",
"will",
"fetch",
"this",
"value",
"once",
"it",
"is",
"needed",
"to",
"format",
"a",
"record",
".",
"Note",
"that",
"backends",
"will",
"cache",
"t... | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/format.go#L132-L136 | test |
op/go-logging | format.go | MustStringFormatter | func MustStringFormatter(format string) Formatter {
f, err := NewStringFormatter(format)
if err != nil {
panic("Failed to initialized string formatter: " + err.Error())
}
return f
} | go | func MustStringFormatter(format string) Formatter {
f, err := NewStringFormatter(format)
if err != nil {
panic("Failed to initialized string formatter: " + err.Error())
}
return f
} | [
"func",
"MustStringFormatter",
"(",
"format",
"string",
")",
"Formatter",
"{",
"f",
",",
"err",
":=",
"NewStringFormatter",
"(",
"format",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"Failed to initialized string formatter: \"",
"+",
"err",
".",
... | // MustStringFormatter is equivalent to NewStringFormatter with a call to panic
// on error. | [
"MustStringFormatter",
"is",
"equivalent",
"to",
"NewStringFormatter",
"with",
"a",
"call",
"to",
"panic",
"on",
"error",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/format.go#L262-L268 | test |
op/go-logging | format.go | formatFuncName | func formatFuncName(v fmtVerb, f string) string {
i := strings.LastIndex(f, "/")
j := strings.Index(f[i+1:], ".")
if j < 1 {
return "???"
}
pkg, fun := f[:i+j+1], f[i+j+2:]
switch v {
case fmtVerbLongpkg:
return pkg
case fmtVerbShortpkg:
return path.Base(pkg)
case fmtVerbLongfunc:
return fun
case fmtV... | go | func formatFuncName(v fmtVerb, f string) string {
i := strings.LastIndex(f, "/")
j := strings.Index(f[i+1:], ".")
if j < 1 {
return "???"
}
pkg, fun := f[:i+j+1], f[i+j+2:]
switch v {
case fmtVerbLongpkg:
return pkg
case fmtVerbShortpkg:
return path.Base(pkg)
case fmtVerbLongfunc:
return fun
case fmtV... | [
"func",
"formatFuncName",
"(",
"v",
"fmtVerb",
",",
"f",
"string",
")",
"string",
"{",
"i",
":=",
"strings",
".",
"LastIndex",
"(",
"f",
",",
"\"/\"",
")",
"\n",
"j",
":=",
"strings",
".",
"Index",
"(",
"f",
"[",
"i",
"+",
"1",
":",
"]",
",",
"... | // formatFuncName tries to extract certain part of the runtime formatted
// function name to some pre-defined variation.
//
// This function is known to not work properly if the package path or name
// contains a dot. | [
"formatFuncName",
"tries",
"to",
"extract",
"certain",
"part",
"of",
"the",
"runtime",
"formatted",
"function",
"name",
"to",
"some",
"pre",
"-",
"defined",
"variation",
".",
"This",
"function",
"is",
"known",
"to",
"not",
"work",
"properly",
"if",
"the",
"p... | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/format.go#L341-L360 | test |
op/go-logging | format.go | Log | func (bf *backendFormatter) Log(level Level, calldepth int, r *Record) error {
// Make a shallow copy of the record and replace any formatter
r2 := *r
r2.formatter = bf.f
return bf.b.Log(level, calldepth+1, &r2)
} | go | func (bf *backendFormatter) Log(level Level, calldepth int, r *Record) error {
// Make a shallow copy of the record and replace any formatter
r2 := *r
r2.formatter = bf.f
return bf.b.Log(level, calldepth+1, &r2)
} | [
"func",
"(",
"bf",
"*",
"backendFormatter",
")",
"Log",
"(",
"level",
"Level",
",",
"calldepth",
"int",
",",
"r",
"*",
"Record",
")",
"error",
"{",
"r2",
":=",
"*",
"r",
"\n",
"r2",
".",
"formatter",
"=",
"bf",
".",
"f",
"\n",
"return",
"bf",
"."... | // Log implements the Log function required by the Backend interface. | [
"Log",
"implements",
"the",
"Log",
"function",
"required",
"by",
"the",
"Backend",
"interface",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/format.go#L409-L414 | test |
op/go-logging | level.go | LogLevel | func LogLevel(level string) (Level, error) {
for i, name := range levelNames {
if strings.EqualFold(name, level) {
return Level(i), nil
}
}
return ERROR, ErrInvalidLogLevel
} | go | func LogLevel(level string) (Level, error) {
for i, name := range levelNames {
if strings.EqualFold(name, level) {
return Level(i), nil
}
}
return ERROR, ErrInvalidLogLevel
} | [
"func",
"LogLevel",
"(",
"level",
"string",
")",
"(",
"Level",
",",
"error",
")",
"{",
"for",
"i",
",",
"name",
":=",
"range",
"levelNames",
"{",
"if",
"strings",
".",
"EqualFold",
"(",
"name",
",",
"level",
")",
"{",
"return",
"Level",
"(",
"i",
"... | // LogLevel returns the log level from a string representation. | [
"LogLevel",
"returns",
"the",
"log",
"level",
"from",
"a",
"string",
"representation",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/level.go#L44-L51 | test |
op/go-logging | level.go | AddModuleLevel | func AddModuleLevel(backend Backend) LeveledBackend {
var leveled LeveledBackend
var ok bool
if leveled, ok = backend.(LeveledBackend); !ok {
leveled = &moduleLeveled{
levels: make(map[string]Level),
backend: backend,
}
}
return leveled
} | go | func AddModuleLevel(backend Backend) LeveledBackend {
var leveled LeveledBackend
var ok bool
if leveled, ok = backend.(LeveledBackend); !ok {
leveled = &moduleLeveled{
levels: make(map[string]Level),
backend: backend,
}
}
return leveled
} | [
"func",
"AddModuleLevel",
"(",
"backend",
"Backend",
")",
"LeveledBackend",
"{",
"var",
"leveled",
"LeveledBackend",
"\n",
"var",
"ok",
"bool",
"\n",
"if",
"leveled",
",",
"ok",
"=",
"backend",
".",
"(",
"LeveledBackend",
")",
";",
"!",
"ok",
"{",
"leveled... | // AddModuleLevel wraps a log backend with knobs to have different log levels
// for different modules. | [
"AddModuleLevel",
"wraps",
"a",
"log",
"backend",
"with",
"knobs",
"to",
"have",
"different",
"log",
"levels",
"for",
"different",
"modules",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/level.go#L77-L87 | test |
op/go-logging | level.go | GetLevel | func (l *moduleLeveled) GetLevel(module string) Level {
level, exists := l.levels[module]
if exists == false {
level, exists = l.levels[""]
// no configuration exists, default to debug
if exists == false {
level = DEBUG
}
}
return level
} | go | func (l *moduleLeveled) GetLevel(module string) Level {
level, exists := l.levels[module]
if exists == false {
level, exists = l.levels[""]
// no configuration exists, default to debug
if exists == false {
level = DEBUG
}
}
return level
} | [
"func",
"(",
"l",
"*",
"moduleLeveled",
")",
"GetLevel",
"(",
"module",
"string",
")",
"Level",
"{",
"level",
",",
"exists",
":=",
"l",
".",
"levels",
"[",
"module",
"]",
"\n",
"if",
"exists",
"==",
"false",
"{",
"level",
",",
"exists",
"=",
"l",
"... | // GetLevel returns the log level for the given module. | [
"GetLevel",
"returns",
"the",
"log",
"level",
"for",
"the",
"given",
"module",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/level.go#L90-L100 | test |
op/go-logging | level.go | SetLevel | func (l *moduleLeveled) SetLevel(level Level, module string) {
l.levels[module] = level
} | go | func (l *moduleLeveled) SetLevel(level Level, module string) {
l.levels[module] = level
} | [
"func",
"(",
"l",
"*",
"moduleLeveled",
")",
"SetLevel",
"(",
"level",
"Level",
",",
"module",
"string",
")",
"{",
"l",
".",
"levels",
"[",
"module",
"]",
"=",
"level",
"\n",
"}"
] | // SetLevel sets the log level for the given module. | [
"SetLevel",
"sets",
"the",
"log",
"level",
"for",
"the",
"given",
"module",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/level.go#L103-L105 | test |
op/go-logging | level.go | IsEnabledFor | func (l *moduleLeveled) IsEnabledFor(level Level, module string) bool {
return level <= l.GetLevel(module)
} | go | func (l *moduleLeveled) IsEnabledFor(level Level, module string) bool {
return level <= l.GetLevel(module)
} | [
"func",
"(",
"l",
"*",
"moduleLeveled",
")",
"IsEnabledFor",
"(",
"level",
"Level",
",",
"module",
"string",
")",
"bool",
"{",
"return",
"level",
"<=",
"l",
".",
"GetLevel",
"(",
"module",
")",
"\n",
"}"
] | // IsEnabledFor will return true if logging is enabled for the given module. | [
"IsEnabledFor",
"will",
"return",
"true",
"if",
"logging",
"is",
"enabled",
"for",
"the",
"given",
"module",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/level.go#L108-L110 | test |
op/go-logging | multi.go | MultiLogger | func MultiLogger(backends ...Backend) LeveledBackend {
var leveledBackends []LeveledBackend
for _, backend := range backends {
leveledBackends = append(leveledBackends, AddModuleLevel(backend))
}
return &multiLogger{leveledBackends}
} | go | func MultiLogger(backends ...Backend) LeveledBackend {
var leveledBackends []LeveledBackend
for _, backend := range backends {
leveledBackends = append(leveledBackends, AddModuleLevel(backend))
}
return &multiLogger{leveledBackends}
} | [
"func",
"MultiLogger",
"(",
"backends",
"...",
"Backend",
")",
"LeveledBackend",
"{",
"var",
"leveledBackends",
"[",
"]",
"LeveledBackend",
"\n",
"for",
"_",
",",
"backend",
":=",
"range",
"backends",
"{",
"leveledBackends",
"=",
"append",
"(",
"leveledBackends"... | // MultiLogger creates a logger which contain multiple loggers. | [
"MultiLogger",
"creates",
"a",
"logger",
"which",
"contain",
"multiple",
"loggers",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/multi.go#L16-L22 | test |
op/go-logging | multi.go | Log | func (b *multiLogger) Log(level Level, calldepth int, rec *Record) (err error) {
for _, backend := range b.backends {
if backend.IsEnabledFor(level, rec.Module) {
// Shallow copy of the record for the formatted cache on Record and get the
// record formatter from the backend.
r2 := *rec
if e := backend.L... | go | func (b *multiLogger) Log(level Level, calldepth int, rec *Record) (err error) {
for _, backend := range b.backends {
if backend.IsEnabledFor(level, rec.Module) {
// Shallow copy of the record for the formatted cache on Record and get the
// record formatter from the backend.
r2 := *rec
if e := backend.L... | [
"func",
"(",
"b",
"*",
"multiLogger",
")",
"Log",
"(",
"level",
"Level",
",",
"calldepth",
"int",
",",
"rec",
"*",
"Record",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"backend",
":=",
"range",
"b",
".",
"backends",
"{",
"if",
"backend",
... | // Log passes the log record to all backends. | [
"Log",
"passes",
"the",
"log",
"record",
"to",
"all",
"backends",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/multi.go#L25-L37 | test |
op/go-logging | multi.go | GetLevel | func (b *multiLogger) GetLevel(module string) Level {
var level Level
for _, backend := range b.backends {
if backendLevel := backend.GetLevel(module); backendLevel > level {
level = backendLevel
}
}
return level
} | go | func (b *multiLogger) GetLevel(module string) Level {
var level Level
for _, backend := range b.backends {
if backendLevel := backend.GetLevel(module); backendLevel > level {
level = backendLevel
}
}
return level
} | [
"func",
"(",
"b",
"*",
"multiLogger",
")",
"GetLevel",
"(",
"module",
"string",
")",
"Level",
"{",
"var",
"level",
"Level",
"\n",
"for",
"_",
",",
"backend",
":=",
"range",
"b",
".",
"backends",
"{",
"if",
"backendLevel",
":=",
"backend",
".",
"GetLeve... | // GetLevel returns the highest level enabled by all backends. | [
"GetLevel",
"returns",
"the",
"highest",
"level",
"enabled",
"by",
"all",
"backends",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/multi.go#L40-L48 | test |
op/go-logging | multi.go | SetLevel | func (b *multiLogger) SetLevel(level Level, module string) {
for _, backend := range b.backends {
backend.SetLevel(level, module)
}
} | go | func (b *multiLogger) SetLevel(level Level, module string) {
for _, backend := range b.backends {
backend.SetLevel(level, module)
}
} | [
"func",
"(",
"b",
"*",
"multiLogger",
")",
"SetLevel",
"(",
"level",
"Level",
",",
"module",
"string",
")",
"{",
"for",
"_",
",",
"backend",
":=",
"range",
"b",
".",
"backends",
"{",
"backend",
".",
"SetLevel",
"(",
"level",
",",
"module",
")",
"\n",... | // SetLevel propagates the same level to all backends. | [
"SetLevel",
"propagates",
"the",
"same",
"level",
"to",
"all",
"backends",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/multi.go#L51-L55 | test |
op/go-logging | multi.go | IsEnabledFor | func (b *multiLogger) IsEnabledFor(level Level, module string) bool {
for _, backend := range b.backends {
if backend.IsEnabledFor(level, module) {
return true
}
}
return false
} | go | func (b *multiLogger) IsEnabledFor(level Level, module string) bool {
for _, backend := range b.backends {
if backend.IsEnabledFor(level, module) {
return true
}
}
return false
} | [
"func",
"(",
"b",
"*",
"multiLogger",
")",
"IsEnabledFor",
"(",
"level",
"Level",
",",
"module",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"backend",
":=",
"range",
"b",
".",
"backends",
"{",
"if",
"backend",
".",
"IsEnabledFor",
"(",
"level",
",",
... | // IsEnabledFor returns true if any of the backends are enabled for it. | [
"IsEnabledFor",
"returns",
"true",
"if",
"any",
"of",
"the",
"backends",
"are",
"enabled",
"for",
"it",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/multi.go#L58-L65 | test |
op/go-logging | log_nix.go | ConvertColors | func ConvertColors(colors []int, bold bool) []string {
converted := []string{}
for _, i := range colors {
if bold {
converted = append(converted, ColorSeqBold(color(i)))
} else {
converted = append(converted, ColorSeq(color(i)))
}
}
return converted
} | go | func ConvertColors(colors []int, bold bool) []string {
converted := []string{}
for _, i := range colors {
if bold {
converted = append(converted, ColorSeqBold(color(i)))
} else {
converted = append(converted, ColorSeq(color(i)))
}
}
return converted
} | [
"func",
"ConvertColors",
"(",
"colors",
"[",
"]",
"int",
",",
"bold",
"bool",
")",
"[",
"]",
"string",
"{",
"converted",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"colors",
"{",
"if",
"bold",
"{",
"converted",
... | // ConvertColors takes a list of ints representing colors for log levels and
// converts them into strings for ANSI color formatting | [
"ConvertColors",
"takes",
"a",
"list",
"of",
"ints",
"representing",
"colors",
"for",
"log",
"levels",
"and",
"converts",
"them",
"into",
"strings",
"for",
"ANSI",
"color",
"formatting"
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/log_nix.go#L80-L91 | test |
op/go-logging | syslog.go | NewSyslogBackend | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) {
var w *syslog.Writer
w, err = syslog.New(syslog.LOG_CRIT, prefix)
return &SyslogBackend{w}, err
} | go | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) {
var w *syslog.Writer
w, err = syslog.New(syslog.LOG_CRIT, prefix)
return &SyslogBackend{w}, err
} | [
"func",
"NewSyslogBackend",
"(",
"prefix",
"string",
")",
"(",
"b",
"*",
"SyslogBackend",
",",
"err",
"error",
")",
"{",
"var",
"w",
"*",
"syslog",
".",
"Writer",
"\n",
"w",
",",
"err",
"=",
"syslog",
".",
"New",
"(",
"syslog",
".",
"LOG_CRIT",
",",
... | // NewSyslogBackend connects to the syslog daemon using UNIX sockets with the
// given prefix. If prefix is not given, the prefix will be derived from the
// launched command. | [
"NewSyslogBackend",
"connects",
"to",
"the",
"syslog",
"daemon",
"using",
"UNIX",
"sockets",
"with",
"the",
"given",
"prefix",
".",
"If",
"prefix",
"is",
"not",
"given",
"the",
"prefix",
"will",
"be",
"derived",
"from",
"the",
"launched",
"command",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/syslog.go#L20-L24 | test |
op/go-logging | syslog.go | NewSyslogBackendPriority | func NewSyslogBackendPriority(prefix string, priority syslog.Priority) (b *SyslogBackend, err error) {
var w *syslog.Writer
w, err = syslog.New(priority, prefix)
return &SyslogBackend{w}, err
} | go | func NewSyslogBackendPriority(prefix string, priority syslog.Priority) (b *SyslogBackend, err error) {
var w *syslog.Writer
w, err = syslog.New(priority, prefix)
return &SyslogBackend{w}, err
} | [
"func",
"NewSyslogBackendPriority",
"(",
"prefix",
"string",
",",
"priority",
"syslog",
".",
"Priority",
")",
"(",
"b",
"*",
"SyslogBackend",
",",
"err",
"error",
")",
"{",
"var",
"w",
"*",
"syslog",
".",
"Writer",
"\n",
"w",
",",
"err",
"=",
"syslog",
... | // NewSyslogBackendPriority is the same as NewSyslogBackend, but with custom
// syslog priority, like syslog.LOG_LOCAL3|syslog.LOG_DEBUG etc. | [
"NewSyslogBackendPriority",
"is",
"the",
"same",
"as",
"NewSyslogBackend",
"but",
"with",
"custom",
"syslog",
"priority",
"like",
"syslog",
".",
"LOG_LOCAL3|syslog",
".",
"LOG_DEBUG",
"etc",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/syslog.go#L28-L32 | test |
op/go-logging | backend.go | SetBackend | func SetBackend(backends ...Backend) LeveledBackend {
var backend Backend
if len(backends) == 1 {
backend = backends[0]
} else {
backend = MultiLogger(backends...)
}
defaultBackend = AddModuleLevel(backend)
return defaultBackend
} | go | func SetBackend(backends ...Backend) LeveledBackend {
var backend Backend
if len(backends) == 1 {
backend = backends[0]
} else {
backend = MultiLogger(backends...)
}
defaultBackend = AddModuleLevel(backend)
return defaultBackend
} | [
"func",
"SetBackend",
"(",
"backends",
"...",
"Backend",
")",
"LeveledBackend",
"{",
"var",
"backend",
"Backend",
"\n",
"if",
"len",
"(",
"backends",
")",
"==",
"1",
"{",
"backend",
"=",
"backends",
"[",
"0",
"]",
"\n",
"}",
"else",
"{",
"backend",
"="... | // SetBackend replaces the backend currently set with the given new logging
// backend. | [
"SetBackend",
"replaces",
"the",
"backend",
"currently",
"set",
"with",
"the",
"given",
"new",
"logging",
"backend",
"."
] | 970db520ece77730c7e4724c61121037378659d9 | https://github.com/op/go-logging/blob/970db520ece77730c7e4724c61121037378659d9/backend.go#L18-L28 | test |
google/subcommands | subcommands.go | NewCommander | func NewCommander(topLevelFlags *flag.FlagSet, name string) *Commander {
cdr := &Commander{
topFlags: topLevelFlags,
name: name,
Output: os.Stdout,
Error: os.Stderr,
}
topLevelFlags.Usage = func() { cdr.explain(cdr.Error) }
return cdr
} | go | func NewCommander(topLevelFlags *flag.FlagSet, name string) *Commander {
cdr := &Commander{
topFlags: topLevelFlags,
name: name,
Output: os.Stdout,
Error: os.Stderr,
}
topLevelFlags.Usage = func() { cdr.explain(cdr.Error) }
return cdr
} | [
"func",
"NewCommander",
"(",
"topLevelFlags",
"*",
"flag",
".",
"FlagSet",
",",
"name",
"string",
")",
"*",
"Commander",
"{",
"cdr",
":=",
"&",
"Commander",
"{",
"topFlags",
":",
"topLevelFlags",
",",
"name",
":",
"name",
",",
"Output",
":",
"os",
".",
... | // NewCommander returns a new commander with the specified top-level
// flags and command name. The Usage function for the topLevelFlags
// will be set as well. | [
"NewCommander",
"returns",
"a",
"new",
"commander",
"with",
"the",
"specified",
"top",
"-",
"level",
"flags",
"and",
"command",
"name",
".",
"The",
"Usage",
"function",
"for",
"the",
"topLevelFlags",
"will",
"be",
"set",
"as",
"well",
"."
] | d47216cd17848d55a33e6f651cbe408243ed55b8 | https://github.com/google/subcommands/blob/d47216cd17848d55a33e6f651cbe408243ed55b8/subcommands.go#L81-L90 | test |
google/subcommands | subcommands.go | Execute | func (cdr *Commander) Execute(ctx context.Context, args ...interface{}) ExitStatus {
if cdr.topFlags.NArg() < 1 {
cdr.topFlags.Usage()
return ExitUsageError
}
name := cdr.topFlags.Arg(0)
for _, group := range cdr.commands {
for _, cmd := range group.commands {
if name != cmd.Name() {
continue
}
... | go | func (cdr *Commander) Execute(ctx context.Context, args ...interface{}) ExitStatus {
if cdr.topFlags.NArg() < 1 {
cdr.topFlags.Usage()
return ExitUsageError
}
name := cdr.topFlags.Arg(0)
for _, group := range cdr.commands {
for _, cmd := range group.commands {
if name != cmd.Name() {
continue
}
... | [
"func",
"(",
"cdr",
"*",
"Commander",
")",
"Execute",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"ExitStatus",
"{",
"if",
"cdr",
".",
"topFlags",
".",
"NArg",
"(",
")",
"<",
"1",
"{",
"cdr",
".",
"topFlag... | // Execute should be called once the top-level-flags on a Commander
// have been initialized. It finds the correct subcommand and executes
// it, and returns an ExitStatus with the result. On a usage error, an
// appropriate message is printed to os.Stderr, and ExitUsageError is
// returned. The additional args are pro... | [
"Execute",
"should",
"be",
"called",
"once",
"the",
"top",
"-",
"level",
"-",
"flags",
"on",
"a",
"Commander",
"have",
"been",
"initialized",
".",
"It",
"finds",
"the",
"correct",
"subcommand",
"and",
"executes",
"it",
"and",
"returns",
"an",
"ExitStatus",
... | d47216cd17848d55a33e6f651cbe408243ed55b8 | https://github.com/google/subcommands/blob/d47216cd17848d55a33e6f651cbe408243ed55b8/subcommands.go#L123-L149 | test |
google/subcommands | subcommands.go | explain | func (cdr *Commander) explain(w io.Writer) {
fmt.Fprintf(w, "Usage: %s <flags> <subcommand> <subcommand args>\n\n", cdr.name)
sort.Sort(byGroupName(cdr.commands))
for _, group := range cdr.commands {
explainGroup(w, group)
}
if cdr.topFlags == nil {
fmt.Fprintln(w, "\nNo top level flags.")
return
}
if len(... | go | func (cdr *Commander) explain(w io.Writer) {
fmt.Fprintf(w, "Usage: %s <flags> <subcommand> <subcommand args>\n\n", cdr.name)
sort.Sort(byGroupName(cdr.commands))
for _, group := range cdr.commands {
explainGroup(w, group)
}
if cdr.topFlags == nil {
fmt.Fprintln(w, "\nNo top level flags.")
return
}
if len(... | [
"func",
"(",
"cdr",
"*",
"Commander",
")",
"explain",
"(",
"w",
"io",
".",
"Writer",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"Usage: %s <flags> <subcommand> <subcommand args>\\n\\n\"",
",",
"\\n",
")",
"\n",
"\\n",
"\n",
"cdr",
".",
"name",
"\n",... | // explain prints a brief description of all the subcommands and the
// important top-level flags. | [
"explain",
"prints",
"a",
"brief",
"description",
"of",
"all",
"the",
"subcommands",
"and",
"the",
"important",
"top",
"-",
"level",
"flags",
"."
] | d47216cd17848d55a33e6f651cbe408243ed55b8 | https://github.com/google/subcommands/blob/d47216cd17848d55a33e6f651cbe408243ed55b8/subcommands.go#L160-L183 | test |
google/subcommands | subcommands.go | explainGroup | func explainGroup(w io.Writer, group *commandGroup) {
if len(group.commands) == 0 {
return
}
if group.name == "" {
fmt.Fprintf(w, "Subcommands:\n")
} else {
fmt.Fprintf(w, "Subcommands for %s:\n", group.name)
}
sort.Sort(group)
aliases := make(map[string][]string)
for _, cmd := range group.commands {
i... | go | func explainGroup(w io.Writer, group *commandGroup) {
if len(group.commands) == 0 {
return
}
if group.name == "" {
fmt.Fprintf(w, "Subcommands:\n")
} else {
fmt.Fprintf(w, "Subcommands for %s:\n", group.name)
}
sort.Sort(group)
aliases := make(map[string][]string)
for _, cmd := range group.commands {
i... | [
"func",
"explainGroup",
"(",
"w",
"io",
".",
"Writer",
",",
"group",
"*",
"commandGroup",
")",
"{",
"if",
"len",
"(",
"group",
".",
"commands",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"if",
"group",
".",
"name",
"==",
"\"\"",
"{",
"fmt",
... | // explainGroup explains all the subcommands for a particular group. | [
"explainGroup",
"explains",
"all",
"the",
"subcommands",
"for",
"a",
"particular",
"group",
"."
] | d47216cd17848d55a33e6f651cbe408243ed55b8 | https://github.com/google/subcommands/blob/d47216cd17848d55a33e6f651cbe408243ed55b8/subcommands.go#L191-L229 | test |
google/subcommands | subcommands.go | explain | func explain(w io.Writer, cmd Command) {
fmt.Fprintf(w, "%s", cmd.Usage())
subflags := flag.NewFlagSet(cmd.Name(), flag.PanicOnError)
subflags.SetOutput(w)
cmd.SetFlags(subflags)
subflags.PrintDefaults()
} | go | func explain(w io.Writer, cmd Command) {
fmt.Fprintf(w, "%s", cmd.Usage())
subflags := flag.NewFlagSet(cmd.Name(), flag.PanicOnError)
subflags.SetOutput(w)
cmd.SetFlags(subflags)
subflags.PrintDefaults()
} | [
"func",
"explain",
"(",
"w",
"io",
".",
"Writer",
",",
"cmd",
"Command",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"%s\"",
",",
"cmd",
".",
"Usage",
"(",
")",
")",
"\n",
"subflags",
":=",
"flag",
".",
"NewFlagSet",
"(",
"cmd",
".",
"Name"... | // explainCmd prints a brief description of a single command. | [
"explainCmd",
"prints",
"a",
"brief",
"description",
"of",
"a",
"single",
"command",
"."
] | d47216cd17848d55a33e6f651cbe408243ed55b8 | https://github.com/google/subcommands/blob/d47216cd17848d55a33e6f651cbe408243ed55b8/subcommands.go#L232-L238 | test |
google/subcommands | subcommands.go | dealias | func dealias(cmd Command) Command {
if alias, ok := cmd.(*aliaser); ok {
return dealias(alias.Command)
}
return cmd
} | go | func dealias(cmd Command) Command {
if alias, ok := cmd.(*aliaser); ok {
return dealias(alias.Command)
}
return cmd
} | [
"func",
"dealias",
"(",
"cmd",
"Command",
")",
"Command",
"{",
"if",
"alias",
",",
"ok",
":=",
"cmd",
".",
"(",
"*",
"aliaser",
")",
";",
"ok",
"{",
"return",
"dealias",
"(",
"alias",
".",
"Command",
")",
"\n",
"}",
"\n",
"return",
"cmd",
"\n",
"... | // dealias recursivly dealiases a command until a non-aliased command
// is reached. | [
"dealias",
"recursivly",
"dealiases",
"a",
"command",
"until",
"a",
"non",
"-",
"aliased",
"command",
"is",
"reached",
"."
] | d47216cd17848d55a33e6f651cbe408243ed55b8 | https://github.com/google/subcommands/blob/d47216cd17848d55a33e6f651cbe408243ed55b8/subcommands.go#L378-L384 | test |
google/subcommands | subcommands.go | Execute | func Execute(ctx context.Context, args ...interface{}) ExitStatus {
return DefaultCommander.Execute(ctx, args...)
} | go | func Execute(ctx context.Context, args ...interface{}) ExitStatus {
return DefaultCommander.Execute(ctx, args...)
} | [
"func",
"Execute",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"ExitStatus",
"{",
"return",
"DefaultCommander",
".",
"Execute",
"(",
"ctx",
",",
"args",
"...",
")",
"\n",
"}"
] | // Execute should be called once the default flags have been
// initialized by flag.Parse. It finds the correct subcommand and
// executes it, and returns an ExitStatus with the result. On a usage
// error, an appropriate message is printed to os.Stderr, and
// ExitUsageError is returned. The additional args are provid... | [
"Execute",
"should",
"be",
"called",
"once",
"the",
"default",
"flags",
"have",
"been",
"initialized",
"by",
"flag",
".",
"Parse",
".",
"It",
"finds",
"the",
"correct",
"subcommand",
"and",
"executes",
"it",
"and",
"returns",
"an",
"ExitStatus",
"with",
"the... | d47216cd17848d55a33e6f651cbe408243ed55b8 | https://github.com/google/subcommands/blob/d47216cd17848d55a33e6f651cbe408243ed55b8/subcommands.go#L419-L421 | test |
Unknwon/goconfig | read.go | LoadFromData | func LoadFromData(data []byte) (c *ConfigFile, err error) {
// Save memory data to temporary file to support further operations.
tmpName := path.Join(os.TempDir(), "goconfig", fmt.Sprintf("%d", time.Now().Nanosecond()))
if err = os.MkdirAll(path.Dir(tmpName), os.ModePerm); err != nil {
return nil, err
}
if err =... | go | func LoadFromData(data []byte) (c *ConfigFile, err error) {
// Save memory data to temporary file to support further operations.
tmpName := path.Join(os.TempDir(), "goconfig", fmt.Sprintf("%d", time.Now().Nanosecond()))
if err = os.MkdirAll(path.Dir(tmpName), os.ModePerm); err != nil {
return nil, err
}
if err =... | [
"func",
"LoadFromData",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"c",
"*",
"ConfigFile",
",",
"err",
"error",
")",
"{",
"tmpName",
":=",
"path",
".",
"Join",
"(",
"os",
".",
"TempDir",
"(",
")",
",",
"\"goconfig\"",
",",
"fmt",
".",
"Sprintf",
"(",... | // LoadFromData accepts raw data directly from memory
// and returns a new configuration representation.
// Note that the configuration is written to the system
// temporary folder, so your file should not contain
// sensitive information. | [
"LoadFromData",
"accepts",
"raw",
"data",
"directly",
"from",
"memory",
"and",
"returns",
"a",
"new",
"configuration",
"representation",
".",
"Note",
"that",
"the",
"configuration",
"is",
"written",
"to",
"the",
"system",
"temporary",
"folder",
"so",
"your",
"fi... | 3dba17dd7b9ec8509b3621a73a30a4b333eb28da | https://github.com/Unknwon/goconfig/blob/3dba17dd7b9ec8509b3621a73a30a4b333eb28da/read.go#L182-L195 | test |
Unknwon/goconfig | read.go | LoadFromReader | func LoadFromReader(in io.Reader) (c *ConfigFile, err error) {
c = newConfigFile([]string{""})
err = c.read(in)
return c, err
} | go | func LoadFromReader(in io.Reader) (c *ConfigFile, err error) {
c = newConfigFile([]string{""})
err = c.read(in)
return c, err
} | [
"func",
"LoadFromReader",
"(",
"in",
"io",
".",
"Reader",
")",
"(",
"c",
"*",
"ConfigFile",
",",
"err",
"error",
")",
"{",
"c",
"=",
"newConfigFile",
"(",
"[",
"]",
"string",
"{",
"\"\"",
"}",
")",
"\n",
"err",
"=",
"c",
".",
"read",
"(",
"in",
... | // LoadFromReader accepts raw data directly from a reader
// and returns a new configuration representation.
// You must use ReloadData to reload.
// You cannot append files a configfile read this way. | [
"LoadFromReader",
"accepts",
"raw",
"data",
"directly",
"from",
"a",
"reader",
"and",
"returns",
"a",
"new",
"configuration",
"representation",
".",
"You",
"must",
"use",
"ReloadData",
"to",
"reload",
".",
"You",
"cannot",
"append",
"files",
"a",
"configfile",
... | 3dba17dd7b9ec8509b3621a73a30a4b333eb28da | https://github.com/Unknwon/goconfig/blob/3dba17dd7b9ec8509b3621a73a30a4b333eb28da/read.go#L201-L205 | test |
Unknwon/goconfig | read.go | ReloadData | func (c *ConfigFile) ReloadData(in io.Reader) (err error) {
var cfg *ConfigFile
if len(c.fileNames) != 1 {
return fmt.Errorf("Multiple files loaded, unable to mix in-memory and file data")
}
cfg, err = LoadFromReader(in)
if err == nil {
*c = *cfg
}
return err
} | go | func (c *ConfigFile) ReloadData(in io.Reader) (err error) {
var cfg *ConfigFile
if len(c.fileNames) != 1 {
return fmt.Errorf("Multiple files loaded, unable to mix in-memory and file data")
}
cfg, err = LoadFromReader(in)
if err == nil {
*c = *cfg
}
return err
} | [
"func",
"(",
"c",
"*",
"ConfigFile",
")",
"ReloadData",
"(",
"in",
"io",
".",
"Reader",
")",
"(",
"err",
"error",
")",
"{",
"var",
"cfg",
"*",
"ConfigFile",
"\n",
"if",
"len",
"(",
"c",
".",
"fileNames",
")",
"!=",
"1",
"{",
"return",
"fmt",
".",... | // ReloadData reloads configuration file from memory | [
"ReloadData",
"reloads",
"configuration",
"file",
"from",
"memory"
] | 3dba17dd7b9ec8509b3621a73a30a4b333eb28da | https://github.com/Unknwon/goconfig/blob/3dba17dd7b9ec8509b3621a73a30a4b333eb28da/read.go#L257-L268 | test |
Unknwon/goconfig | read.go | AppendFiles | func (c *ConfigFile) AppendFiles(files ...string) error {
if len(c.fileNames) == 1 && c.fileNames[0] == "" {
return fmt.Errorf("Cannot append file data to in-memory data")
}
c.fileNames = append(c.fileNames, files...)
return c.Reload()
} | go | func (c *ConfigFile) AppendFiles(files ...string) error {
if len(c.fileNames) == 1 && c.fileNames[0] == "" {
return fmt.Errorf("Cannot append file data to in-memory data")
}
c.fileNames = append(c.fileNames, files...)
return c.Reload()
} | [
"func",
"(",
"c",
"*",
"ConfigFile",
")",
"AppendFiles",
"(",
"files",
"...",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"c",
".",
"fileNames",
")",
"==",
"1",
"&&",
"c",
".",
"fileNames",
"[",
"0",
"]",
"==",
"\"\"",
"{",
"return",
"fmt",
".... | // AppendFiles appends more files to ConfigFile and reload automatically. | [
"AppendFiles",
"appends",
"more",
"files",
"to",
"ConfigFile",
"and",
"reload",
"automatically",
"."
] | 3dba17dd7b9ec8509b3621a73a30a4b333eb28da | https://github.com/Unknwon/goconfig/blob/3dba17dd7b9ec8509b3621a73a30a4b333eb28da/read.go#L271-L277 | test |
Unknwon/goconfig | conf.go | GetKeyList | func (c *ConfigFile) GetKeyList(section string) []string {
// Blank section name represents DEFAULT section.
if len(section) == 0 {
section = DEFAULT_SECTION
}
if c.BlockMode {
c.lock.RLock()
defer c.lock.RUnlock()
}
// Check if section exists.
if _, ok := c.data[section]; !ok {
return nil
}
// Non-... | go | func (c *ConfigFile) GetKeyList(section string) []string {
// Blank section name represents DEFAULT section.
if len(section) == 0 {
section = DEFAULT_SECTION
}
if c.BlockMode {
c.lock.RLock()
defer c.lock.RUnlock()
}
// Check if section exists.
if _, ok := c.data[section]; !ok {
return nil
}
// Non-... | [
"func",
"(",
"c",
"*",
"ConfigFile",
")",
"GetKeyList",
"(",
"section",
"string",
")",
"[",
"]",
"string",
"{",
"if",
"len",
"(",
"section",
")",
"==",
"0",
"{",
"section",
"=",
"DEFAULT_SECTION",
"\n",
"}",
"\n",
"if",
"c",
".",
"BlockMode",
"{",
... | // GetKeyList returns the list of all keys in give section
// in the same order in the file.
// It returns nil if given section does not exist. | [
"GetKeyList",
"returns",
"the",
"list",
"of",
"all",
"keys",
"in",
"give",
"section",
"in",
"the",
"same",
"order",
"in",
"the",
"file",
".",
"It",
"returns",
"nil",
"if",
"given",
"section",
"does",
"not",
"exist",
"."
] | 3dba17dd7b9ec8509b3621a73a30a4b333eb28da | https://github.com/Unknwon/goconfig/blob/3dba17dd7b9ec8509b3621a73a30a4b333eb28da/conf.go#L360-L384 | test |
Unknwon/goconfig | write.go | SaveConfigData | func SaveConfigData(c *ConfigFile, out io.Writer) (err error) {
equalSign := "="
if PrettyFormat {
equalSign = " = "
}
buf := bytes.NewBuffer(nil)
for _, section := range c.sectionList {
// Write section comments.
if len(c.GetSectionComments(section)) > 0 {
if _, err = buf.WriteString(c.GetSectionComment... | go | func SaveConfigData(c *ConfigFile, out io.Writer) (err error) {
equalSign := "="
if PrettyFormat {
equalSign = " = "
}
buf := bytes.NewBuffer(nil)
for _, section := range c.sectionList {
// Write section comments.
if len(c.GetSectionComments(section)) > 0 {
if _, err = buf.WriteString(c.GetSectionComment... | [
"func",
"SaveConfigData",
"(",
"c",
"*",
"ConfigFile",
",",
"out",
"io",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"equalSign",
":=",
"\"=\"",
"\n",
"if",
"PrettyFormat",
"{",
"equalSign",
"=",
"\" = \"",
"\n",
"}",
"\n",
"buf",
":=",
"bytes",... | // SaveConfigData writes configuration to a writer | [
"SaveConfigData",
"writes",
"configuration",
"to",
"a",
"writer"
] | 3dba17dd7b9ec8509b3621a73a30a4b333eb28da | https://github.com/Unknwon/goconfig/blob/3dba17dd7b9ec8509b3621a73a30a4b333eb28da/write.go#L28-L103 | test |
Unknwon/goconfig | write.go | SaveConfigFile | func SaveConfigFile(c *ConfigFile, filename string) (err error) {
// Write configuration file by filename.
var f *os.File
if f, err = os.Create(filename); err != nil {
return err
}
if err := SaveConfigData(c, f); err != nil {
return err
}
return f.Close()
} | go | func SaveConfigFile(c *ConfigFile, filename string) (err error) {
// Write configuration file by filename.
var f *os.File
if f, err = os.Create(filename); err != nil {
return err
}
if err := SaveConfigData(c, f); err != nil {
return err
}
return f.Close()
} | [
"func",
"SaveConfigFile",
"(",
"c",
"*",
"ConfigFile",
",",
"filename",
"string",
")",
"(",
"err",
"error",
")",
"{",
"var",
"f",
"*",
"os",
".",
"File",
"\n",
"if",
"f",
",",
"err",
"=",
"os",
".",
"Create",
"(",
"filename",
")",
";",
"err",
"!=... | // SaveConfigFile writes configuration file to local file system | [
"SaveConfigFile",
"writes",
"configuration",
"file",
"to",
"local",
"file",
"system"
] | 3dba17dd7b9ec8509b3621a73a30a4b333eb28da | https://github.com/Unknwon/goconfig/blob/3dba17dd7b9ec8509b3621a73a30a4b333eb28da/write.go#L106-L117 | test |
sclevine/agouti | selectable.go | Find | func (s *selectable) Find(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.CSS, selector).Single())
} | go | func (s *selectable) Find(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.CSS, selector).Single())
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"Find",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"CSS",
",",
"selector",
")",
"... | // Find finds exactly one element by CSS selector. | [
"Find",
"finds",
"exactly",
"one",
"element",
"by",
"CSS",
"selector",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L69-L71 | test |
sclevine/agouti | selectable.go | FindByXPath | func (s *selectable) FindByXPath(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.XPath, selector).Single())
} | go | func (s *selectable) FindByXPath(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.XPath, selector).Single())
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByXPath",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"XPath",
",",
"selector",
... | // FindByXPath finds exactly one element by XPath selector. | [
"FindByXPath",
"finds",
"exactly",
"one",
"element",
"by",
"XPath",
"selector",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L74-L76 | test |
sclevine/agouti | selectable.go | FindByLink | func (s *selectable) FindByLink(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Link, text).Single())
} | go | func (s *selectable) FindByLink(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Link, text).Single())
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByLink",
"(",
"text",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Link",
",",
"text",
")",
".... | // FindByLink finds exactly one anchor element by its text content. | [
"FindByLink",
"finds",
"exactly",
"one",
"anchor",
"element",
"by",
"its",
"text",
"content",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L79-L81 | test |
sclevine/agouti | selectable.go | FindByLabel | func (s *selectable) FindByLabel(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Label, text).Single())
} | go | func (s *selectable) FindByLabel(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Label, text).Single())
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByLabel",
"(",
"text",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Label",
",",
"text",
")",
... | // FindByLabel finds exactly one element by associated label text. | [
"FindByLabel",
"finds",
"exactly",
"one",
"element",
"by",
"associated",
"label",
"text",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L84-L86 | test |
sclevine/agouti | selectable.go | FindByName | func (s *selectable) FindByName(name string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Name, name).Single())
} | go | func (s *selectable) FindByName(name string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Name, name).Single())
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByName",
"(",
"name",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Name",
",",
"name",
")",
".... | // FindByName finds exactly element with the provided name attribute. | [
"FindByName",
"finds",
"exactly",
"element",
"with",
"the",
"provided",
"name",
"attribute",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L95-L97 | test |
sclevine/agouti | selectable.go | FindByClass | func (s *selectable) FindByClass(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Class, text).Single())
} | go | func (s *selectable) FindByClass(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Class, text).Single())
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByClass",
"(",
"text",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Class",
",",
"text",
")",
... | // FindByClass finds exactly one element with a given CSS class. | [
"FindByClass",
"finds",
"exactly",
"one",
"element",
"with",
"a",
"given",
"CSS",
"class",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L100-L102 | test |
sclevine/agouti | selectable.go | FindByID | func (s *selectable) FindByID(id string) *Selection {
return newSelection(s.session, s.selectors.Append(target.ID, id).Single())
} | go | func (s *selectable) FindByID(id string) *Selection {
return newSelection(s.session, s.selectors.Append(target.ID, id).Single())
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByID",
"(",
"id",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"ID",
",",
"id",
")",
".",
"Si... | // FindByID finds exactly one element that has the given ID. | [
"FindByID",
"finds",
"exactly",
"one",
"element",
"that",
"has",
"the",
"given",
"ID",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L105-L107 | test |
sclevine/agouti | selectable.go | First | func (s *selectable) First(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.CSS, selector).At(0))
} | go | func (s *selectable) First(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.CSS, selector).At(0))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"First",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"CSS",
",",
"selector",
")",
... | // First finds the first element by CSS selector. | [
"First",
"finds",
"the",
"first",
"element",
"by",
"CSS",
"selector",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L110-L112 | test |
sclevine/agouti | selectable.go | FirstByXPath | func (s *selectable) FirstByXPath(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.XPath, selector).At(0))
} | go | func (s *selectable) FirstByXPath(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.XPath, selector).At(0))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FirstByXPath",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"XPath",
",",
"selector",
... | // FirstByXPath finds the first element by XPath selector. | [
"FirstByXPath",
"finds",
"the",
"first",
"element",
"by",
"XPath",
"selector",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L115-L117 | test |
sclevine/agouti | selectable.go | FirstByLink | func (s *selectable) FirstByLink(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Link, text).At(0))
} | go | func (s *selectable) FirstByLink(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Link, text).At(0))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FirstByLink",
"(",
"text",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Link",
",",
"text",
")",
"... | // FirstByLink finds the first anchor element by its text content. | [
"FirstByLink",
"finds",
"the",
"first",
"anchor",
"element",
"by",
"its",
"text",
"content",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L120-L122 | test |
sclevine/agouti | selectable.go | FirstByLabel | func (s *selectable) FirstByLabel(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Label, text).At(0))
} | go | func (s *selectable) FirstByLabel(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Label, text).At(0))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FirstByLabel",
"(",
"text",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Label",
",",
"text",
")",
... | // FirstByLabel finds the first element by associated label text. | [
"FirstByLabel",
"finds",
"the",
"first",
"element",
"by",
"associated",
"label",
"text",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L125-L127 | test |
sclevine/agouti | selectable.go | FirstByName | func (s *selectable) FirstByName(name string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Name, name).At(0))
} | go | func (s *selectable) FirstByName(name string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Name, name).At(0))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FirstByName",
"(",
"name",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Name",
",",
"name",
")",
"... | // FirstByName finds the first element with the provided name attribute. | [
"FirstByName",
"finds",
"the",
"first",
"element",
"with",
"the",
"provided",
"name",
"attribute",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L136-L138 | test |
sclevine/agouti | selectable.go | All | func (s *selectable) All(selector string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.CSS, selector))
} | go | func (s *selectable) All(selector string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.CSS, selector))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"All",
"(",
"selector",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"CSS",
",",
"selector",
... | // All finds zero or more elements by CSS selector. | [
"All",
"finds",
"zero",
"or",
"more",
"elements",
"by",
"CSS",
"selector",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L146-L148 | test |
sclevine/agouti | selectable.go | AllByXPath | func (s *selectable) AllByXPath(selector string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.XPath, selector))
} | go | func (s *selectable) AllByXPath(selector string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.XPath, selector))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"AllByXPath",
"(",
"selector",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"XPath",
",",
"sel... | // AllByXPath finds zero or more elements by XPath selector. | [
"AllByXPath",
"finds",
"zero",
"or",
"more",
"elements",
"by",
"XPath",
"selector",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L151-L153 | test |
sclevine/agouti | selectable.go | AllByLink | func (s *selectable) AllByLink(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.Link, text))
} | go | func (s *selectable) AllByLink(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.Link, text))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"AllByLink",
"(",
"text",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Link",
",",
"text",
... | // AllByLink finds zero or more anchor elements by their text content. | [
"AllByLink",
"finds",
"zero",
"or",
"more",
"anchor",
"elements",
"by",
"their",
"text",
"content",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L156-L158 | test |
sclevine/agouti | selectable.go | AllByLabel | func (s *selectable) AllByLabel(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.Label, text))
} | go | func (s *selectable) AllByLabel(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.Label, text))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"AllByLabel",
"(",
"text",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Label",
",",
"text",
... | // AllByLabel finds zero or more elements by associated label text. | [
"AllByLabel",
"finds",
"zero",
"or",
"more",
"elements",
"by",
"associated",
"label",
"text",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L161-L163 | test |
sclevine/agouti | selectable.go | AllByName | func (s *selectable) AllByName(name string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.Name, name))
} | go | func (s *selectable) AllByName(name string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.Name, name))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"AllByName",
"(",
"name",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Name",
",",
"name",
... | // AllByName finds zero or more elements with the provided name attribute. | [
"AllByName",
"finds",
"zero",
"or",
"more",
"elements",
"with",
"the",
"provided",
"name",
"attribute",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L172-L174 | test |
sclevine/agouti | selectable.go | AllByClass | func (s *selectable) AllByClass(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.Class, text))
} | go | func (s *selectable) AllByClass(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.Class, text))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"AllByClass",
"(",
"text",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Class",
",",
"text",
... | // AllByClass finds zero or more elements with a given CSS class. | [
"AllByClass",
"finds",
"zero",
"or",
"more",
"elements",
"with",
"a",
"given",
"CSS",
"class",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L177-L179 | test |
sclevine/agouti | selectable.go | AllByID | func (s *selectable) AllByID(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.ID, text))
} | go | func (s *selectable) AllByID(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.ID, text))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"AllByID",
"(",
"text",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"ID",
",",
"text",
")",... | // AllByID finds zero or more elements with a given ID. | [
"AllByID",
"finds",
"zero",
"or",
"more",
"elements",
"with",
"a",
"given",
"ID",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L182-L184 | test |
sclevine/agouti | selectable.go | FindForAppium | func (s *selectable) FindForAppium(selectorType string, text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Class, text).At(0))
} | go | func (s *selectable) FindForAppium(selectorType string, text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Class, text).At(0))
} | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindForAppium",
"(",
"selectorType",
"string",
",",
"text",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
"."... | // FirstByClass finds the first element with a given CSS class. | [
"FirstByClass",
"finds",
"the",
"first",
"element",
"with",
"a",
"given",
"CSS",
"class",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L187-L189 | test |
sclevine/agouti | options.go | Timeout | func Timeout(seconds int) Option {
return func(c *config) {
c.Timeout = time.Duration(seconds) * time.Second
}
} | go | func Timeout(seconds int) Option {
return func(c *config) {
c.Timeout = time.Duration(seconds) * time.Second
}
} | [
"func",
"Timeout",
"(",
"seconds",
"int",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"config",
")",
"{",
"c",
".",
"Timeout",
"=",
"time",
".",
"Duration",
"(",
"seconds",
")",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n",
"}"
] | // Timeout provides an Option for specifying a timeout in seconds. | [
"Timeout",
"provides",
"an",
"Option",
"for",
"specifying",
"a",
"timeout",
"in",
"seconds",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/options.go#L29-L33 | test |
sclevine/agouti | options.go | ChromeOptions | func ChromeOptions(opt string, value interface{}) Option {
return func(c *config) {
if c.ChromeOptions == nil {
c.ChromeOptions = make(map[string]interface{})
}
c.ChromeOptions[opt] = value
}
} | go | func ChromeOptions(opt string, value interface{}) Option {
return func(c *config) {
if c.ChromeOptions == nil {
c.ChromeOptions = make(map[string]interface{})
}
c.ChromeOptions[opt] = value
}
} | [
"func",
"ChromeOptions",
"(",
"opt",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"config",
")",
"{",
"if",
"c",
".",
"ChromeOptions",
"==",
"nil",
"{",
"c",
".",
"ChromeOptions",
"=",
"make",
"(... | // ChromeOptions is used to pass additional options to Chrome via ChromeDriver. | [
"ChromeOptions",
"is",
"used",
"to",
"pass",
"additional",
"options",
"to",
"Chrome",
"via",
"ChromeDriver",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/options.go#L36-L43 | test |
sclevine/agouti | page.go | JoinPage | func JoinPage(url string, options ...Option) *Page {
pageOptions := config{}.Merge(options)
session := api.NewWithClient(url, pageOptions.HTTPClient)
return newPage(session)
} | go | func JoinPage(url string, options ...Option) *Page {
pageOptions := config{}.Merge(options)
session := api.NewWithClient(url, pageOptions.HTTPClient)
return newPage(session)
} | [
"func",
"JoinPage",
"(",
"url",
"string",
",",
"options",
"...",
"Option",
")",
"*",
"Page",
"{",
"pageOptions",
":=",
"config",
"{",
"}",
".",
"Merge",
"(",
"options",
")",
"\n",
"session",
":=",
"api",
".",
"NewWithClient",
"(",
"url",
",",
"pageOpti... | // JoinPage creates a Page using existing session URL. This method takes Options
// but respects only the HTTPClient Option if provided. | [
"JoinPage",
"creates",
"a",
"Page",
"using",
"existing",
"session",
"URL",
".",
"This",
"method",
"takes",
"Options",
"but",
"respects",
"only",
"the",
"HTTPClient",
"Option",
"if",
"provided",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L53-L57 | test |
sclevine/agouti | page.go | Destroy | func (p *Page) Destroy() error {
if err := p.session.Delete(); err != nil {
return fmt.Errorf("failed to destroy session: %s", err)
}
return nil
} | go | func (p *Page) Destroy() error {
if err := p.session.Delete(); err != nil {
return fmt.Errorf("failed to destroy session: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"Destroy",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"Delete",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to destroy session: %s\"",
",",
"err"... | // Destroy closes any open browsers by ending the session. | [
"Destroy",
"closes",
"any",
"open",
"browsers",
"by",
"ending",
"the",
"session",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L75-L80 | test |
sclevine/agouti | page.go | Reset | func (p *Page) Reset() error {
p.ConfirmPopup()
url, err := p.URL()
if err != nil {
return err
}
if url == "about:blank" {
return nil
}
if err := p.ClearCookies(); err != nil {
return err
}
if err := p.session.DeleteLocalStorage(); err != nil {
if err := p.RunScript("localStorage.clear();", nil, nil... | go | func (p *Page) Reset() error {
p.ConfirmPopup()
url, err := p.URL()
if err != nil {
return err
}
if url == "about:blank" {
return nil
}
if err := p.ClearCookies(); err != nil {
return err
}
if err := p.session.DeleteLocalStorage(); err != nil {
if err := p.RunScript("localStorage.clear();", nil, nil... | [
"func",
"(",
"p",
"*",
"Page",
")",
"Reset",
"(",
")",
"error",
"{",
"p",
".",
"ConfirmPopup",
"(",
")",
"\n",
"url",
",",
"err",
":=",
"p",
".",
"URL",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
... | // Reset deletes all cookies set for the current domain and navigates to a blank page.
// Unlike Destroy, Reset will permit the page to be re-used after it is called.
// Reset is faster than Destroy, but any cookies from domains outside the current
// domain will remain after a page is reset. | [
"Reset",
"deletes",
"all",
"cookies",
"set",
"for",
"the",
"current",
"domain",
"and",
"navigates",
"to",
"a",
"blank",
"page",
".",
"Unlike",
"Destroy",
"Reset",
"will",
"permit",
"the",
"page",
"to",
"be",
"re",
"-",
"used",
"after",
"it",
"is",
"calle... | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L86-L114 | test |
sclevine/agouti | page.go | Navigate | func (p *Page) Navigate(url string) error {
if err := p.session.SetURL(url); err != nil {
return fmt.Errorf("failed to navigate: %s", err)
}
return nil
} | go | func (p *Page) Navigate(url string) error {
if err := p.session.SetURL(url); err != nil {
return fmt.Errorf("failed to navigate: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"Navigate",
"(",
"url",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"SetURL",
"(",
"url",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to navigat... | // Navigate navigates to the provided URL. | [
"Navigate",
"navigates",
"to",
"the",
"provided",
"URL",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L117-L122 | test |
sclevine/agouti | page.go | GetCookies | func (p *Page) GetCookies() ([]*http.Cookie, error) {
apiCookies, err := p.session.GetCookies()
if err != nil {
return nil, fmt.Errorf("failed to get cookies: %s", err)
}
cookies := []*http.Cookie{}
for _, apiCookie := range apiCookies {
expSeconds := int64(apiCookie.Expiry)
expNano := int64(apiCookie.Expiry... | go | func (p *Page) GetCookies() ([]*http.Cookie, error) {
apiCookies, err := p.session.GetCookies()
if err != nil {
return nil, fmt.Errorf("failed to get cookies: %s", err)
}
cookies := []*http.Cookie{}
for _, apiCookie := range apiCookies {
expSeconds := int64(apiCookie.Expiry)
expNano := int64(apiCookie.Expiry... | [
"func",
"(",
"p",
"*",
"Page",
")",
"GetCookies",
"(",
")",
"(",
"[",
"]",
"*",
"http",
".",
"Cookie",
",",
"error",
")",
"{",
"apiCookies",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetCookies",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // GetCookies returns all cookies on the page. | [
"GetCookies",
"returns",
"all",
"cookies",
"on",
"the",
"page",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L125-L146 | test |
sclevine/agouti | page.go | SetCookie | func (p *Page) SetCookie(cookie *http.Cookie) error {
if cookie == nil {
return errors.New("nil cookie is invalid")
}
var expiry int64
if !cookie.Expires.IsZero() {
expiry = cookie.Expires.Unix()
}
apiCookie := &api.Cookie{
Name: cookie.Name,
Value: cookie.Value,
Path: cookie.Path,
Domain... | go | func (p *Page) SetCookie(cookie *http.Cookie) error {
if cookie == nil {
return errors.New("nil cookie is invalid")
}
var expiry int64
if !cookie.Expires.IsZero() {
expiry = cookie.Expires.Unix()
}
apiCookie := &api.Cookie{
Name: cookie.Name,
Value: cookie.Value,
Path: cookie.Path,
Domain... | [
"func",
"(",
"p",
"*",
"Page",
")",
"SetCookie",
"(",
"cookie",
"*",
"http",
".",
"Cookie",
")",
"error",
"{",
"if",
"cookie",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"nil cookie is invalid\"",
")",
"\n",
"}",
"\n",
"var",
"expiry",
... | // SetCookie sets a cookie on the page. | [
"SetCookie",
"sets",
"a",
"cookie",
"on",
"the",
"page",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L149-L173 | test |
sclevine/agouti | page.go | DeleteCookie | func (p *Page) DeleteCookie(name string) error {
if err := p.session.DeleteCookie(name); err != nil {
return fmt.Errorf("failed to delete cookie %s: %s", name, err)
}
return nil
} | go | func (p *Page) DeleteCookie(name string) error {
if err := p.session.DeleteCookie(name); err != nil {
return fmt.Errorf("failed to delete cookie %s: %s", name, err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"DeleteCookie",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"DeleteCookie",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"faile... | // DeleteCookie deletes a cookie on the page by name. | [
"DeleteCookie",
"deletes",
"a",
"cookie",
"on",
"the",
"page",
"by",
"name",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L176-L181 | test |
sclevine/agouti | page.go | ClearCookies | func (p *Page) ClearCookies() error {
if err := p.session.DeleteCookies(); err != nil {
return fmt.Errorf("failed to clear cookies: %s", err)
}
return nil
} | go | func (p *Page) ClearCookies() error {
if err := p.session.DeleteCookies(); err != nil {
return fmt.Errorf("failed to clear cookies: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"ClearCookies",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"DeleteCookies",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to clear cookies: %s\"",
",... | // ClearCookies deletes all cookies on the page. | [
"ClearCookies",
"deletes",
"all",
"cookies",
"on",
"the",
"page",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L184-L189 | test |
sclevine/agouti | page.go | URL | func (p *Page) URL() (string, error) {
url, err := p.session.GetURL()
if err != nil {
return "", fmt.Errorf("failed to retrieve URL: %s", err)
}
return url, nil
} | go | func (p *Page) URL() (string, error) {
url, err := p.session.GetURL()
if err != nil {
return "", fmt.Errorf("failed to retrieve URL: %s", err)
}
return url, nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"URL",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"url",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetURL",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
",",
"fmt",
".",
"Errorf... | // URL returns the current page URL. | [
"URL",
"returns",
"the",
"current",
"page",
"URL",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L192-L198 | test |
sclevine/agouti | page.go | Size | func (p *Page) Size(width, height int) error {
window, err := p.session.GetWindow()
if err != nil {
return fmt.Errorf("failed to retrieve window: %s", err)
}
if err := window.SetSize(width, height); err != nil {
return fmt.Errorf("failed to set window size: %s", err)
}
return nil
} | go | func (p *Page) Size(width, height int) error {
window, err := p.session.GetWindow()
if err != nil {
return fmt.Errorf("failed to retrieve window: %s", err)
}
if err := window.SetSize(width, height); err != nil {
return fmt.Errorf("failed to set window size: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"Size",
"(",
"width",
",",
"height",
"int",
")",
"error",
"{",
"window",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetWindow",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
... | // Size sets the current page size in pixels. | [
"Size",
"sets",
"the",
"current",
"page",
"size",
"in",
"pixels",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L201-L212 | test |
sclevine/agouti | page.go | Screenshot | func (p *Page) Screenshot(filename string) error {
absFilePath, err := filepath.Abs(filename)
if err != nil {
return fmt.Errorf("failed to find absolute path for filename: %s", err)
}
screenshot, err := p.session.GetScreenshot()
if err != nil {
return fmt.Errorf("failed to retrieve screenshot: %s", err)
}
... | go | func (p *Page) Screenshot(filename string) error {
absFilePath, err := filepath.Abs(filename)
if err != nil {
return fmt.Errorf("failed to find absolute path for filename: %s", err)
}
screenshot, err := p.session.GetScreenshot()
if err != nil {
return fmt.Errorf("failed to retrieve screenshot: %s", err)
}
... | [
"func",
"(",
"p",
"*",
"Page",
")",
"Screenshot",
"(",
"filename",
"string",
")",
"error",
"{",
"absFilePath",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
... | // Screenshot takes a screenshot and saves it to the provided filename.
// The provided filename may be an absolute or relative path. | [
"Screenshot",
"takes",
"a",
"screenshot",
"and",
"saves",
"it",
"to",
"the",
"provided",
"filename",
".",
"The",
"provided",
"filename",
"may",
"be",
"an",
"absolute",
"or",
"relative",
"path",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L216-L232 | test |
sclevine/agouti | page.go | Title | func (p *Page) Title() (string, error) {
title, err := p.session.GetTitle()
if err != nil {
return "", fmt.Errorf("failed to retrieve page title: %s", err)
}
return title, nil
} | go | func (p *Page) Title() (string, error) {
title, err := p.session.GetTitle()
if err != nil {
return "", fmt.Errorf("failed to retrieve page title: %s", err)
}
return title, nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"Title",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"title",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetTitle",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
",",
"fmt",
".",
"... | // Title returns the page title. | [
"Title",
"returns",
"the",
"page",
"title",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L235-L241 | test |
sclevine/agouti | page.go | HTML | func (p *Page) HTML() (string, error) {
html, err := p.session.GetSource()
if err != nil {
return "", fmt.Errorf("failed to retrieve page HTML: %s", err)
}
return html, nil
} | go | func (p *Page) HTML() (string, error) {
html, err := p.session.GetSource()
if err != nil {
return "", fmt.Errorf("failed to retrieve page HTML: %s", err)
}
return html, nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"HTML",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"html",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetSource",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
",",
"fmt",
".",
"E... | // HTML returns the current contents of the DOM for the entire page. | [
"HTML",
"returns",
"the",
"current",
"contents",
"of",
"the",
"DOM",
"for",
"the",
"entire",
"page",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L244-L250 | test |
sclevine/agouti | page.go | PopupText | func (p *Page) PopupText() (string, error) {
text, err := p.session.GetAlertText()
if err != nil {
return "", fmt.Errorf("failed to retrieve popup text: %s", err)
}
return text, nil
} | go | func (p *Page) PopupText() (string, error) {
text, err := p.session.GetAlertText()
if err != nil {
return "", fmt.Errorf("failed to retrieve popup text: %s", err)
}
return text, nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"PopupText",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"text",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetAlertText",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
",",
"fmt",
"... | // PopupText returns the current alert, confirm, or prompt popup text. | [
"PopupText",
"returns",
"the",
"current",
"alert",
"confirm",
"or",
"prompt",
"popup",
"text",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L283-L289 | test |
sclevine/agouti | page.go | EnterPopupText | func (p *Page) EnterPopupText(text string) error {
if err := p.session.SetAlertText(text); err != nil {
return fmt.Errorf("failed to enter popup text: %s", err)
}
return nil
} | go | func (p *Page) EnterPopupText(text string) error {
if err := p.session.SetAlertText(text); err != nil {
return fmt.Errorf("failed to enter popup text: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"EnterPopupText",
"(",
"text",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"SetAlertText",
"(",
"text",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"fai... | // EnterPopupText enters text into an open prompt popup. | [
"EnterPopupText",
"enters",
"text",
"into",
"an",
"open",
"prompt",
"popup",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L292-L297 | test |
sclevine/agouti | page.go | ConfirmPopup | func (p *Page) ConfirmPopup() error {
if err := p.session.AcceptAlert(); err != nil {
return fmt.Errorf("failed to confirm popup: %s", err)
}
return nil
} | go | func (p *Page) ConfirmPopup() error {
if err := p.session.AcceptAlert(); err != nil {
return fmt.Errorf("failed to confirm popup: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"ConfirmPopup",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"AcceptAlert",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to confirm popup: %s\"",
",",... | // ConfirmPopup confirms an alert, confirm, or prompt popup. | [
"ConfirmPopup",
"confirms",
"an",
"alert",
"confirm",
"or",
"prompt",
"popup",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L300-L305 | test |
sclevine/agouti | page.go | CancelPopup | func (p *Page) CancelPopup() error {
if err := p.session.DismissAlert(); err != nil {
return fmt.Errorf("failed to cancel popup: %s", err)
}
return nil
} | go | func (p *Page) CancelPopup() error {
if err := p.session.DismissAlert(); err != nil {
return fmt.Errorf("failed to cancel popup: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"CancelPopup",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"DismissAlert",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to cancel popup: %s\"",
",",
... | // CancelPopup cancels an alert, confirm, or prompt popup. | [
"CancelPopup",
"cancels",
"an",
"alert",
"confirm",
"or",
"prompt",
"popup",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L308-L313 | test |
sclevine/agouti | page.go | SwitchToParentFrame | func (p *Page) SwitchToParentFrame() error {
if err := p.session.FrameParent(); err != nil {
return fmt.Errorf("failed to switch to parent frame: %s", err)
}
return nil
} | go | func (p *Page) SwitchToParentFrame() error {
if err := p.session.FrameParent(); err != nil {
return fmt.Errorf("failed to switch to parent frame: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"SwitchToParentFrame",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"FrameParent",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to switch to parent fram... | // SwitchToParentFrame focuses on the immediate parent frame of a frame selected
// by Selection.Frame. After switching, all new and existing selections will refer
// to the parent frame. All further Page methods will apply to this frame as well.
//
// This method is not supported by PhantomJS. Please use SwitchToRootF... | [
"SwitchToParentFrame",
"focuses",
"on",
"the",
"immediate",
"parent",
"frame",
"of",
"a",
"frame",
"selected",
"by",
"Selection",
".",
"Frame",
".",
"After",
"switching",
"all",
"new",
"and",
"existing",
"selections",
"will",
"refer",
"to",
"the",
"parent",
"f... | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L344-L349 | test |
sclevine/agouti | page.go | SwitchToRootFrame | func (p *Page) SwitchToRootFrame() error {
if err := p.session.Frame(nil); err != nil {
return fmt.Errorf("failed to switch to original page frame: %s", err)
}
return nil
} | go | func (p *Page) SwitchToRootFrame() error {
if err := p.session.Frame(nil); err != nil {
return fmt.Errorf("failed to switch to original page frame: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"SwitchToRootFrame",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"Frame",
"(",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to switch to original p... | // SwitchToRootFrame focuses on the original, default page frame before any calls
// to Selection.Frame were made. After switching, all new and existing selections
// will refer to the root frame. All further Page methods will apply to this frame
// as well. | [
"SwitchToRootFrame",
"focuses",
"on",
"the",
"original",
"default",
"page",
"frame",
"before",
"any",
"calls",
"to",
"Selection",
".",
"Frame",
"were",
"made",
".",
"After",
"switching",
"all",
"new",
"and",
"existing",
"selections",
"will",
"refer",
"to",
"th... | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L355-L360 | test |
sclevine/agouti | page.go | NextWindow | func (p *Page) NextWindow() error {
windows, err := p.session.GetWindows()
if err != nil {
return fmt.Errorf("failed to find available windows: %s", err)
}
var windowIDs []string
for _, window := range windows {
windowIDs = append(windowIDs, window.ID)
}
// order not defined according to W3 spec
sort.Stri... | go | func (p *Page) NextWindow() error {
windows, err := p.session.GetWindows()
if err != nil {
return fmt.Errorf("failed to find available windows: %s", err)
}
var windowIDs []string
for _, window := range windows {
windowIDs = append(windowIDs, window.ID)
}
// order not defined according to W3 spec
sort.Stri... | [
"func",
"(",
"p",
"*",
"Page",
")",
"NextWindow",
"(",
")",
"error",
"{",
"windows",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetWindows",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to find avail... | // NextWindow switches to the next available window. | [
"NextWindow",
"switches",
"to",
"the",
"next",
"available",
"window",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L372-L403 | test |
sclevine/agouti | page.go | CloseWindow | func (p *Page) CloseWindow() error {
if err := p.session.DeleteWindow(); err != nil {
return fmt.Errorf("failed to close active window: %s", err)
}
return nil
} | go | func (p *Page) CloseWindow() error {
if err := p.session.DeleteWindow(); err != nil {
return fmt.Errorf("failed to close active window: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"CloseWindow",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"DeleteWindow",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to close active window: %s\"",
... | // CloseWindow closes the active window. | [
"CloseWindow",
"closes",
"the",
"active",
"window",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L406-L411 | test |
sclevine/agouti | page.go | WindowCount | func (p *Page) WindowCount() (int, error) {
windows, err := p.session.GetWindows()
if err != nil {
return 0, fmt.Errorf("failed to find available windows: %s", err)
}
return len(windows), nil
} | go | func (p *Page) WindowCount() (int, error) {
windows, err := p.session.GetWindows()
if err != nil {
return 0, fmt.Errorf("failed to find available windows: %s", err)
}
return len(windows), nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"WindowCount",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"windows",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetWindows",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",... | // WindowCount returns the number of available windows. | [
"WindowCount",
"returns",
"the",
"number",
"of",
"available",
"windows",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L414-L420 | test |
sclevine/agouti | page.go | LogTypes | func (p *Page) LogTypes() ([]string, error) {
types, err := p.session.GetLogTypes()
if err != nil {
return nil, fmt.Errorf("failed to retrieve log types: %s", err)
}
return types, nil
} | go | func (p *Page) LogTypes() ([]string, error) {
types, err := p.session.GetLogTypes()
if err != nil {
return nil, fmt.Errorf("failed to retrieve log types: %s", err)
}
return types, nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"LogTypes",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"types",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetLogTypes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
... | // LogTypes returns all of the valid log types that may be used with a LogReader. | [
"LogTypes",
"returns",
"all",
"of",
"the",
"valid",
"log",
"types",
"that",
"may",
"be",
"used",
"with",
"a",
"LogReader",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L423-L429 | test |
sclevine/agouti | page.go | MoveMouseBy | func (p *Page) MoveMouseBy(xOffset, yOffset int) error {
if err := p.session.MoveTo(nil, api.XYOffset{X: xOffset, Y: yOffset}); err != nil {
return fmt.Errorf("failed to move mouse: %s", err)
}
return nil
} | go | func (p *Page) MoveMouseBy(xOffset, yOffset int) error {
if err := p.session.MoveTo(nil, api.XYOffset{X: xOffset, Y: yOffset}); err != nil {
return fmt.Errorf("failed to move mouse: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"MoveMouseBy",
"(",
"xOffset",
",",
"yOffset",
"int",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"MoveTo",
"(",
"nil",
",",
"api",
".",
"XYOffset",
"{",
"X",
":",
"xOffset",
",",
"Y",
":",
... | // MoveMouseBy moves the mouse by the provided offset. | [
"MoveMouseBy",
"moves",
"the",
"mouse",
"by",
"the",
"provided",
"offset",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L482-L488 | test |
sclevine/agouti | page.go | DoubleClick | func (p *Page) DoubleClick() error {
if err := p.session.DoubleClick(); err != nil {
return fmt.Errorf("failed to double click: %s", err)
}
return nil
} | go | func (p *Page) DoubleClick() error {
if err := p.session.DoubleClick(); err != nil {
return fmt.Errorf("failed to double click: %s", err)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Page",
")",
"DoubleClick",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"DoubleClick",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"failed to double click: %s\"",
",",
... | // DoubleClick double clicks the left mouse button at the current mouse
// position. | [
"DoubleClick",
"double",
"clicks",
"the",
"left",
"mouse",
"button",
"at",
"the",
"current",
"mouse",
"position",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L492-L498 | test |
sclevine/agouti | page.go | Click | func (p *Page) Click(event Click, button Button) error {
var err error
switch event {
case SingleClick:
err = p.session.Click(api.Button(button))
case HoldClick:
err = p.session.ButtonDown(api.Button(button))
case ReleaseClick:
err = p.session.ButtonUp(api.Button(button))
default:
err = errors.New("invali... | go | func (p *Page) Click(event Click, button Button) error {
var err error
switch event {
case SingleClick:
err = p.session.Click(api.Button(button))
case HoldClick:
err = p.session.ButtonDown(api.Button(button))
case ReleaseClick:
err = p.session.ButtonUp(api.Button(button))
default:
err = errors.New("invali... | [
"func",
"(",
"p",
"*",
"Page",
")",
"Click",
"(",
"event",
"Click",
",",
"button",
"Button",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"switch",
"event",
"{",
"case",
"SingleClick",
":",
"err",
"=",
"p",
".",
"session",
".",
"Click",
"(",
"ap... | // Click performs the provided Click event using the provided Button at the
// current mouse position. | [
"Click",
"performs",
"the",
"provided",
"Click",
"event",
"using",
"the",
"provided",
"Button",
"at",
"the",
"current",
"mouse",
"position",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/page.go#L502-L519 | test |
sclevine/agouti | selection_actions.go | Click | func (s *Selection) Click() error {
return s.forEachElement(func(selectedElement element.Element) error {
if err := selectedElement.Click(); err != nil {
return fmt.Errorf("failed to click on %s: %s", s, err)
}
return nil
})
} | go | func (s *Selection) Click() error {
return s.forEachElement(func(selectedElement element.Element) error {
if err := selectedElement.Click(); err != nil {
return fmt.Errorf("failed to click on %s: %s", s, err)
}
return nil
})
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Click",
"(",
")",
"error",
"{",
"return",
"s",
".",
"forEachElement",
"(",
"func",
"(",
"selectedElement",
"element",
".",
"Element",
")",
"error",
"{",
"if",
"err",
":=",
"selectedElement",
".",
"Click",
"(",
... | // Click clicks on all of the elements that the selection refers to. | [
"Click",
"clicks",
"on",
"all",
"of",
"the",
"elements",
"that",
"the",
"selection",
"refers",
"to",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_actions.go#L29-L36 | test |
sclevine/agouti | selection_actions.go | DoubleClick | func (s *Selection) DoubleClick() error {
return s.forEachElement(func(selectedElement element.Element) error {
if err := s.session.MoveTo(selectedElement.(*api.Element), nil); err != nil {
return fmt.Errorf("failed to move mouse to %s: %s", s, err)
}
if err := s.session.DoubleClick(); err != nil {
return ... | go | func (s *Selection) DoubleClick() error {
return s.forEachElement(func(selectedElement element.Element) error {
if err := s.session.MoveTo(selectedElement.(*api.Element), nil); err != nil {
return fmt.Errorf("failed to move mouse to %s: %s", s, err)
}
if err := s.session.DoubleClick(); err != nil {
return ... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"DoubleClick",
"(",
")",
"error",
"{",
"return",
"s",
".",
"forEachElement",
"(",
"func",
"(",
"selectedElement",
"element",
".",
"Element",
")",
"error",
"{",
"if",
"err",
":=",
"s",
".",
"session",
".",
"MoveT... | // DoubleClick double-clicks on all of the elements that the selection refers to. | [
"DoubleClick",
"double",
"-",
"clicks",
"on",
"all",
"of",
"the",
"elements",
"that",
"the",
"selection",
"refers",
"to",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_actions.go#L39-L49 | test |
sclevine/agouti | selection_actions.go | Fill | func (s *Selection) Fill(text string) error {
return s.forEachElement(func(selectedElement element.Element) error {
if err := selectedElement.Clear(); err != nil {
return fmt.Errorf("failed to clear %s: %s", s, err)
}
if err := selectedElement.Value(text); err != nil {
return fmt.Errorf("failed to enter te... | go | func (s *Selection) Fill(text string) error {
return s.forEachElement(func(selectedElement element.Element) error {
if err := selectedElement.Clear(); err != nil {
return fmt.Errorf("failed to clear %s: %s", s, err)
}
if err := selectedElement.Value(text); err != nil {
return fmt.Errorf("failed to enter te... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Fill",
"(",
"text",
"string",
")",
"error",
"{",
"return",
"s",
".",
"forEachElement",
"(",
"func",
"(",
"selectedElement",
"element",
".",
"Element",
")",
"error",
"{",
"if",
"err",
":=",
"selectedElement",
".",... | // Fill fills all of the fields the selection refers to with the provided text. | [
"Fill",
"fills",
"all",
"of",
"the",
"fields",
"the",
"selection",
"refers",
"to",
"with",
"the",
"provided",
"text",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_actions.go#L62-L72 | test |
sclevine/agouti | selection_actions.go | Tap | func (s *Selection) Tap(event Tap) error {
var touchFunc func(*api.Element) error
switch event {
case SingleTap:
touchFunc = s.session.TouchClick
case DoubleTap:
touchFunc = s.session.TouchDoubleClick
case LongTap:
touchFunc = s.session.TouchLongClick
default:
return fmt.Errorf("failed to %s on %s: invali... | go | func (s *Selection) Tap(event Tap) error {
var touchFunc func(*api.Element) error
switch event {
case SingleTap:
touchFunc = s.session.TouchClick
case DoubleTap:
touchFunc = s.session.TouchDoubleClick
case LongTap:
touchFunc = s.session.TouchLongClick
default:
return fmt.Errorf("failed to %s on %s: invali... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Tap",
"(",
"event",
"Tap",
")",
"error",
"{",
"var",
"touchFunc",
"func",
"(",
"*",
"api",
".",
"Element",
")",
"error",
"\n",
"switch",
"event",
"{",
"case",
"SingleTap",
":",
"touchFunc",
"=",
"s",
".",
"... | // Tap performs the provided Tap event on each element in the selection. | [
"Tap",
"performs",
"the",
"provided",
"Tap",
"event",
"on",
"each",
"element",
"in",
"the",
"selection",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_actions.go#L175-L194 | test |
sclevine/agouti | selection_actions.go | Touch | func (s *Selection) Touch(event Touch) error {
var touchFunc func(x, y int) error
switch event {
case HoldFinger:
touchFunc = s.session.TouchDown
case ReleaseFinger:
touchFunc = s.session.TouchUp
case MoveFinger:
touchFunc = s.session.TouchMove
default:
return fmt.Errorf("failed to %s on %s: invalid touch... | go | func (s *Selection) Touch(event Touch) error {
var touchFunc func(x, y int) error
switch event {
case HoldFinger:
touchFunc = s.session.TouchDown
case ReleaseFinger:
touchFunc = s.session.TouchUp
case MoveFinger:
touchFunc = s.session.TouchMove
default:
return fmt.Errorf("failed to %s on %s: invalid touch... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Touch",
"(",
"event",
"Touch",
")",
"error",
"{",
"var",
"touchFunc",
"func",
"(",
"x",
",",
"y",
"int",
")",
"error",
"\n",
"switch",
"event",
"{",
"case",
"HoldFinger",
":",
"touchFunc",
"=",
"s",
".",
"s... | // Touch performs the provided Touch event at the location of each element in the
// selection. | [
"Touch",
"performs",
"the",
"provided",
"Touch",
"event",
"at",
"the",
"location",
"of",
"each",
"element",
"in",
"the",
"selection",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_actions.go#L198-L221 | test |
sclevine/agouti | selection_actions.go | FlickFinger | func (s *Selection) FlickFinger(xOffset, yOffset int, speed uint) error {
selectedElement, err := s.elements.GetExactlyOne()
if err != nil {
return fmt.Errorf("failed to select element from %s: %s", s, err)
}
if err := s.session.TouchFlick(selectedElement.(*api.Element), api.XYOffset{X: xOffset, Y: yOffset}, api... | go | func (s *Selection) FlickFinger(xOffset, yOffset int, speed uint) error {
selectedElement, err := s.elements.GetExactlyOne()
if err != nil {
return fmt.Errorf("failed to select element from %s: %s", s, err)
}
if err := s.session.TouchFlick(selectedElement.(*api.Element), api.XYOffset{X: xOffset, Y: yOffset}, api... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"FlickFinger",
"(",
"xOffset",
",",
"yOffset",
"int",
",",
"speed",
"uint",
")",
"error",
"{",
"selectedElement",
",",
"err",
":=",
"s",
".",
"elements",
".",
"GetExactlyOne",
"(",
")",
"\n",
"if",
"err",
"!=",
... | // FlickFinger performs a flick touch action by the provided offset and at the
// provided speed on exactly one element. | [
"FlickFinger",
"performs",
"a",
"flick",
"touch",
"action",
"by",
"the",
"provided",
"offset",
"and",
"at",
"the",
"provided",
"speed",
"on",
"exactly",
"one",
"element",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_actions.go#L225-L235 | test |
sclevine/agouti | selection_actions.go | ScrollFinger | func (s *Selection) ScrollFinger(xOffset, yOffset int) error {
selectedElement, err := s.elements.GetExactlyOne()
if err != nil {
return fmt.Errorf("failed to select element from %s: %s", s, err)
}
if err := s.session.TouchScroll(selectedElement.(*api.Element), api.XYOffset{X: xOffset, Y: yOffset}); err != nil {... | go | func (s *Selection) ScrollFinger(xOffset, yOffset int) error {
selectedElement, err := s.elements.GetExactlyOne()
if err != nil {
return fmt.Errorf("failed to select element from %s: %s", s, err)
}
if err := s.session.TouchScroll(selectedElement.(*api.Element), api.XYOffset{X: xOffset, Y: yOffset}); err != nil {... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ScrollFinger",
"(",
"xOffset",
",",
"yOffset",
"int",
")",
"error",
"{",
"selectedElement",
",",
"err",
":=",
"s",
".",
"elements",
".",
"GetExactlyOne",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",... | // ScrollFinger performs a scroll touch action by the provided offset on exactly
// one element. | [
"ScrollFinger",
"performs",
"a",
"scroll",
"touch",
"action",
"by",
"the",
"provided",
"offset",
"on",
"exactly",
"one",
"element",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_actions.go#L239-L249 | test |
sclevine/agouti | capabilities.go | NewCapabilities | func NewCapabilities(features ...string) Capabilities {
c := Capabilities{}
for _, feature := range features {
c.With(feature)
}
return c
} | go | func NewCapabilities(features ...string) Capabilities {
c := Capabilities{}
for _, feature := range features {
c.With(feature)
}
return c
} | [
"func",
"NewCapabilities",
"(",
"features",
"...",
"string",
")",
"Capabilities",
"{",
"c",
":=",
"Capabilities",
"{",
"}",
"\n",
"for",
"_",
",",
"feature",
":=",
"range",
"features",
"{",
"c",
".",
"With",
"(",
"feature",
")",
"\n",
"}",
"\n",
"retur... | // NewCapabilities returns a Capabilities instance with any provided features enabled. | [
"NewCapabilities",
"returns",
"a",
"Capabilities",
"instance",
"with",
"any",
"provided",
"features",
"enabled",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/capabilities.go#L17-L23 | test |
sclevine/agouti | capabilities.go | JSON | func (c Capabilities) JSON() (string, error) {
capabilitiesJSON, err := json.Marshal(c)
return string(capabilitiesJSON), err
} | go | func (c Capabilities) JSON() (string, error) {
capabilitiesJSON, err := json.Marshal(c)
return string(capabilitiesJSON), err
} | [
"func",
"(",
"c",
"Capabilities",
")",
"JSON",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"capabilitiesJSON",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"c",
")",
"\n",
"return",
"string",
"(",
"capabilitiesJSON",
")",
",",
"err",
"\n",
"}"... | // JSON returns a JSON string representing the desired capabilities. | [
"JSON",
"returns",
"a",
"JSON",
"string",
"representing",
"the",
"desired",
"capabilities",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/capabilities.go#L86-L89 | test |
sclevine/agouti | matchers/page_matchers.go | HaveTitle | func HaveTitle(title string) types.GomegaMatcher {
return &internal.ValueMatcher{Method: "Title", Property: "title", Expected: title}
} | go | func HaveTitle(title string) types.GomegaMatcher {
return &internal.ValueMatcher{Method: "Title", Property: "title", Expected: title}
} | [
"func",
"HaveTitle",
"(",
"title",
"string",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"internal",
".",
"ValueMatcher",
"{",
"Method",
":",
"\"Title\"",
",",
"Property",
":",
"\"title\"",
",",
"Expected",
":",
"title",
"}",
"\n",
"}"
] | // HaveTitle passes when the expected title is equivalent to the
// title of the provided page. | [
"HaveTitle",
"passes",
"when",
"the",
"expected",
"title",
"is",
"equivalent",
"to",
"the",
"title",
"of",
"the",
"provided",
"page",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/matchers/page_matchers.go#L10-L12 | test |
sclevine/agouti | matchers/page_matchers.go | HaveURL | func HaveURL(url string) types.GomegaMatcher {
return &internal.ValueMatcher{Method: "URL", Property: "URL", Expected: url}
} | go | func HaveURL(url string) types.GomegaMatcher {
return &internal.ValueMatcher{Method: "URL", Property: "URL", Expected: url}
} | [
"func",
"HaveURL",
"(",
"url",
"string",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"internal",
".",
"ValueMatcher",
"{",
"Method",
":",
"\"URL\"",
",",
"Property",
":",
"\"URL\"",
",",
"Expected",
":",
"url",
"}",
"\n",
"}"
] | // HaveURL passes when the expected URL is equivalent to the
// current URL of the provided page. | [
"HaveURL",
"passes",
"when",
"the",
"expected",
"URL",
"is",
"equivalent",
"to",
"the",
"current",
"URL",
"of",
"the",
"provided",
"page",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/matchers/page_matchers.go#L16-L18 | test |
sclevine/agouti | matchers/page_matchers.go | HavePopupText | func HavePopupText(text string) types.GomegaMatcher {
return &internal.ValueMatcher{Method: "PopupText", Property: "popup text", Expected: text}
} | go | func HavePopupText(text string) types.GomegaMatcher {
return &internal.ValueMatcher{Method: "PopupText", Property: "popup text", Expected: text}
} | [
"func",
"HavePopupText",
"(",
"text",
"string",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"internal",
".",
"ValueMatcher",
"{",
"Method",
":",
"\"PopupText\"",
",",
"Property",
":",
"\"popup text\"",
",",
"Expected",
":",
"text",
"}",
"\n",
"}"... | // HavePopupText passes when the expected text is equivalent to the
// text contents of an open alert, confirm, or prompt popup. | [
"HavePopupText",
"passes",
"when",
"the",
"expected",
"text",
"is",
"equivalent",
"to",
"the",
"text",
"contents",
"of",
"an",
"open",
"alert",
"confirm",
"or",
"prompt",
"popup",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/matchers/page_matchers.go#L22-L24 | test |
sclevine/agouti | matchers/page_matchers.go | HaveLoggedError | func HaveLoggedError(messages ...string) types.GomegaMatcher {
return &internal.LogMatcher{
ExpectedMessages: messages,
Levels: []string{"WARNING", "SEVERE"},
Name: "error",
Type: "browser",
}
} | go | func HaveLoggedError(messages ...string) types.GomegaMatcher {
return &internal.LogMatcher{
ExpectedMessages: messages,
Levels: []string{"WARNING", "SEVERE"},
Name: "error",
Type: "browser",
}
} | [
"func",
"HaveLoggedError",
"(",
"messages",
"...",
"string",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"internal",
".",
"LogMatcher",
"{",
"ExpectedMessages",
":",
"messages",
",",
"Levels",
":",
"[",
"]",
"string",
"{",
"\"WARNING\"",
",",
"\"... | // HaveLoggedError passes when all of the expected log messages are logged as
// errors in the browser console. If no message is provided, this matcher will
// pass if any error message has been logged. When negated, this matcher will
// only fail if all of the provided messages are logged. | [
"HaveLoggedError",
"passes",
"when",
"all",
"of",
"the",
"expected",
"log",
"messages",
"are",
"logged",
"as",
"errors",
"in",
"the",
"browser",
"console",
".",
"If",
"no",
"message",
"is",
"provided",
"this",
"matcher",
"will",
"pass",
"if",
"any",
"error",... | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/matchers/page_matchers.go#L36-L43 | test |
sclevine/agouti | selection_properties.go | Text | func (s *Selection) Text() (string, error) {
selectedElement, err := s.elements.GetExactlyOne()
if err != nil {
return "", fmt.Errorf("failed to select element from %s: %s", s, err)
}
text, err := selectedElement.GetText()
if err != nil {
return "", fmt.Errorf("failed to retrieve text for %s: %s", s, err)
}
... | go | func (s *Selection) Text() (string, error) {
selectedElement, err := s.elements.GetExactlyOne()
if err != nil {
return "", fmt.Errorf("failed to select element from %s: %s", s, err)
}
text, err := selectedElement.GetText()
if err != nil {
return "", fmt.Errorf("failed to retrieve text for %s: %s", s, err)
}
... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Text",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"selectedElement",
",",
"err",
":=",
"s",
".",
"elements",
".",
"GetExactlyOne",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
",",... | // Text returns the entirety of the text content for exactly one element. | [
"Text",
"returns",
"the",
"entirety",
"of",
"the",
"text",
"content",
"for",
"exactly",
"one",
"element",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_properties.go#L10-L21 | test |
sclevine/agouti | selection_properties.go | Active | func (s *Selection) Active() (bool, error) {
selectedElement, err := s.elements.GetExactlyOne()
if err != nil {
return false, fmt.Errorf("failed to select element from %s: %s", s, err)
}
activeElement, err := s.session.GetActiveElement()
if err != nil {
return false, fmt.Errorf("failed to retrieve active elem... | go | func (s *Selection) Active() (bool, error) {
selectedElement, err := s.elements.GetExactlyOne()
if err != nil {
return false, fmt.Errorf("failed to select element from %s: %s", s, err)
}
activeElement, err := s.session.GetActiveElement()
if err != nil {
return false, fmt.Errorf("failed to retrieve active elem... | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Active",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"selectedElement",
",",
"err",
":=",
"s",
".",
"elements",
".",
"GetExactlyOne",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
","... | // Active returns true if the single element that the selection refers to is active. | [
"Active",
"returns",
"true",
"if",
"the",
"single",
"element",
"that",
"the",
"selection",
"refers",
"to",
"is",
"active",
"."
] | 96599c91888f1b1cf2dccc7f1776ba7f511909e5 | https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selection_properties.go#L24-L41 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.