Fixing chromeSend.

master
Pedro de Oliveira Guedes 2021-12-28 12:49:57 -03:00
parent 58fbb932aa
commit d5c986df8e
1 changed files with 4 additions and 4 deletions

View File

@ -64,16 +64,16 @@ func (c *Cli) Wait(id string, s string, to int) (string, error) {
json.Unmarshal(bs, &ret) json.Unmarshal(bs, &ret)
return ret, err return ret, err
} }
func (c *Cli) Send(id string, m string, ps map[string]interface{}) (string, error) { func (c *Cli) Send(id string, m string, ps map[string]interface{}) (interface{}, error) {
// id -> ID do Websocket no qual se deseja realizar a alteração. // id -> ID do Websocket no qual se deseja realizar a alteração.
ret := "" var ret interface{}
in := map[string]interface{}{ in := map[string]interface{}{
"method": m, "method": m,
"params": ps, "params": ps,
} }
err := c.HttpCli().JsonPost("/ipc/chrome/eval/"+id, in, &ret) err := c.HttpCli().JsonPost("/ipc/chrome/send/"+id, in, &ret)
return ret, err return ret, err
// ret -> // ret -> Retorno do comando (Referência em: https://chromedevtools.github.io/devtools-protocol/)
} }
func (c *Cli) OpenTabs() (ret []map[string]string, err error) { func (c *Cli) OpenTabs() (ret []map[string]string, err error) {