Skip to content

Commit

Permalink
feat(添加自动识别勾选登录服务协议): chinaTelecom.go
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdaExpression authored and LambdaExpression committed May 19, 2022
1 parent 9d4e428 commit 06bae52
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tools/chinaTelecom.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func login(ctx context.Context, username, password string) {
indexUrl := "https://e.189.cn/wap/index.do"
var collectLink string
var res string
var jAgreementCheckboxHtml string

var b1, b2, b3 []byte
var ck []*network.Cookie
Expand All @@ -113,9 +114,28 @@ func login(ctx context.Context, username, password string) {
chromedp.CaptureScreenshot(&b1),
chromedp.Click(`j-other-login-way2`, chromedp.ByID),
chromedp.WaitVisible(`j-login-btn`, chromedp.ByID),
chromedp.OuterHTML("j-agreement-checkbox", &jAgreementCheckboxHtml, chromedp.ByID),
)
if err != nil {
configs.Logger.Error("error", err)
outLogonPng(b1, b2, b3)
return
}

if !strings.Contains(jAgreementCheckboxHtml, "ag-ckbox") {
err = chromedp.Run(ctx,
chromedp.Click(`j-agreement-checkbox`, chromedp.ByID),
)
if err != nil {
configs.Logger.Error("error", err)
outLogonPng(b1, b2, b3)
return
}
}

err = chromedp.Run(ctx,
chromedp.SendKeys(`j-userName`, username, chromedp.ByID),
chromedp.SendKeys(`j-password`, password, chromedp.ByID),
//chromedp.Click(`j-agreement-checkbox`, chromedp.ByID),
chromedp.Click(`j-login-btn`, chromedp.ByID),
chromedp.CaptureScreenshot(&b2),
chromedp.WaitVisible(`_userMobile`, chromedp.ByID),
Expand Down

0 comments on commit 06bae52

Please sign in to comment.