1

有一个页面有很多按钮。我想跳过它们以获取页面内容并搜索其中的元素。我应该怎么办?


func GetOrders(result *[]tools.Order) chromedp.Tasks {

    var currentUrL string

    var nodes []*cdp.Node


    return chromedp.Tasks{

        chromedp.Navigate(Url),

        //chromedp.Evaluate("document.querySelector('#J_Static2Quick').click();", &res),

        chromedp.Location(&currentUrL),

        chromedp.Nodes(".js-order-container", &nodes, chromedp.ByQueryAll),

        chromedp.ActionFunc(func(ctx context.Context) error {



            count := len(nodes)
            fmt.Println("count:", count)

            for _, v := range nodes {

                // todo search button and  click

            }

            return  nil
        }),


    }
}
4

0 回答 0