java - 如何截取验证码并将其放入 JFrame
问题描述
我正在开发我的第一个 java 软件作为项目,使用我从大学学到的东西。我正在尝试将这个网站转换为学生使用它来获得结果的软件。
对不起,该网站是法语,请使用谷歌翻译页面。
网址:https ://www2.inscription.tn/ORegMx/servlet/AuthentificationEtud?ident=cin
该网站有一个验证码,用户需要看到它才能编写它。该链接需要加载一次,因此验证码不会更改。所以我正在考虑截取打开链接的验证码并将图像放入JFrame
.
请在代码前检查设计
WebDriver driver = new HtmlUnitDriver();
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
driver.navigate().to("https://www4.inscription.tn/ORegMx/servlet/AuthentificationEtud?ident=cin");
WebElement c = driver.findElement(By.name("cin"));
WebElement d = driver.findElement(By.id("dn"));
WebElement cap = driver.findElement(By.id("cincap"));
String cin = CIN.getText();
String date = daten.getText();
String capp = code.getText();
// fill the fields
c.sendKeys(cin);
d.sendKeys(date);
cap.sendKeys(capp);
// Now submit the form. WebDriver will find the form for us from the element
cap.submit();
我可以在没有 Firefox 或 google chrome 的情况下获取屏幕截图吗?只使用 HtmlUnitDriver?请有人告诉我该怎么做,在获取验证码的屏幕截图(alt capito 的验证码元素)后,我该如何将其放入JFrame
?
我在eclipse中使用windowbuilder pro。
解决方案
推荐阅读
- excel - .Add2 生成运行时错误“438”:对象在 Excel VBA 中不支持此属性或方法
- javascript - 节点用户模型获取类型错误:无法设置未定义的属性“getUserId”
- php - PHP in_array( 0, ['aaa', 'bbb'] ) 返回 TRUE?
- dart - Rxdart 包与 google_sign_in 或 flutter_facebook_login 一起使用时会导致 Flutter 应用程序在启动时崩溃
- angular - 使用http时的角度6未定义函数
- xamarin.android - 命名空间无法正确解析 Android.Support.V4.App.ListFragment
- android - 侦听器仅将列表中的最后一个图像添加到 RecyclerView
- angular - 如何在 Angular 测试中强制关闭 mat-dialog?
- python - 按周 python 的时间序列组
- sql - 如何自我加入条件并在前面添加一列?