mirror of https://github.com/daffainfo/nuclei.git
feat: expose WaitVisible method from the rod library
parent
f5fb8aa305
commit
4e54a61b65
|
@ -50,6 +50,8 @@ const (
|
|||
ActionDebug
|
||||
// ActionSleep executes a sleep for a specified duration
|
||||
ActionSleep
|
||||
// ActionWaitVisible waits until an element appears.
|
||||
ActionWaitVisible
|
||||
)
|
||||
|
||||
// ActionStringToAction converts an action from string to internal representation
|
||||
|
@ -75,6 +77,7 @@ var ActionStringToAction = map[string]ActionType{
|
|||
"keyboard": ActionKeyboard,
|
||||
"debug": ActionDebug,
|
||||
"sleep": ActionSleep,
|
||||
"waitvisible": ActionWaitVisible,
|
||||
}
|
||||
|
||||
// ActionToActionString converts an action from internal representation to string
|
||||
|
@ -100,6 +103,7 @@ var ActionToActionString = map[ActionType]string{
|
|||
ActionKeyboard: "keyboard",
|
||||
ActionDebug: "debug",
|
||||
ActionSleep: "sleep",
|
||||
ActionWaitVisible: "waitvisible",
|
||||
}
|
||||
|
||||
// Action is an action taken by the browser to reach a navigation
|
||||
|
|
|
@ -67,6 +67,8 @@ func (p *Page) ExecuteActions(baseURL *url.URL, actions []*Action) (map[string]s
|
|||
err = p.DebugAction(act, outData)
|
||||
case ActionSleep:
|
||||
err = p.SleepAction(act, outData)
|
||||
case ActionWaitVisible:
|
||||
err = p.WaitVisible(act, outData)
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
@ -83,6 +85,15 @@ type requestRule struct {
|
|||
Args map[string]string
|
||||
}
|
||||
|
||||
// WaitVisible waits until an element appears.
|
||||
func (p *Page) WaitVisible(act *Action, out map[string]string) error {
|
||||
element, err := p.pageElementBy(act.Data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return element.WaitVisible()
|
||||
}
|
||||
|
||||
// ActionAddHeader executes a AddHeader action.
|
||||
func (p *Page) ActionAddHeader(act *Action, out map[string]string /*TODO review unused parameter*/) error {
|
||||
in := act.GetArg("part")
|
||||
|
|
Loading…
Reference in New Issue