我正在尝试使用Selenium在网站上自动执行登录过程。我想输入我的数据,然后自己输入验证码。但是,当我点击验证码时,我会收到大量的验证码和错误。有没有办法让我不再遇到持续的验证码?
答案 0 :(得分:2)
Captchas专门用于打破自动化。我会要求产品负责人添加某种cookie或机制,以使chaptcha不在那里。
答案 1 :(得分:0)
不幸的是,正如@Dominic所说,CAPTCHA不能被打破。但我已经要求开发人员包含测试环境URL参数,该参数可以在测试环境中用于禁用/隐藏CAPTCH-as。但如果您想调查我听说过这项服务http://deathbycaptcha.com当然需要付费。
以下是一些补充代码:
import com.DeathByCaptcha.AccessDeniedException;
import com.DeathByCaptcha.Captcha;
import com.DeathByCaptcha.Client;
import com.DeathByCaptcha.SocketClient;
import com.DeathByCaptcha.HttpClient;
/* Put your DeathByCaptcha account username and password here.
Use HttpClient for HTTP API. */
Client client = (Client)new SocketClient(username, password);
try {
double balance = client.getBalance();
/* Put your CAPTCHA file name, or file object, or arbitrary input stream,
or an array of bytes, and optional solving timeout (in seconds) here: */
Captcha captcha = client.decode(captchaFileName, timeout);
if (null != captcha) {
/* The CAPTCHA was solved; captcha.id property holds its numeric ID,
and captcha.text holds its text. */
System.out.println("CAPTCHA " + captcha.id + " solved: " + captcha.text);
if (/* check if the CAPTCHA was incorrectly solved */) {
client.report(captcha);
}
}
} catch (AccessDeniedException e) {
/* Access to DBC API denied, check your credentials and/or balance */
}
此代码未经过测试,我刚刚在网上找到,也许它会帮助你。