Пример #1
0
func TestCapture(t *testing.T) {
	a := antigate.New("")

	// From URL
	captcha_text, _ := a.ProcessFromUrl(captureUrl)
	fmt.Println("from url:", captcha_text)
}
Пример #2
0
func processingOfCaptcha(url string, sess *webdriver.Session, cap *Capture) error {
	log.Print("START USING ANTIGATE FOR ", url)
	a := antigate.New(*antigateKey)
	captchaText, err := a.ProcessFromUrl(cap.Capture)
	if err != nil {
		return errors.New("can't process captcha from url by antigate url=" + cap.Capture + " err=" + err.Error())
	}
	inputEl, err := sess.FindElement(webdriver.CSS_Selector, `input.input__control.i-bem`)
	if err != nil {
		return errors.New("can't find input element for set capcha text: " + url + " error ::" + err.Error())
	}

	err = inputEl.SendKeys(captchaText)
	if err != nil {
		return errors.New("can't set captcha text by url " + url + " error ::" + err.Error())
	}
	err = inputEl.Submit()
	if err != nil {
		return errors.New("can't submit captcha answer:" + url + " error ::" + err.Error())
	}
	return nil
}