Selenium自动化测试
绕过验证码登录的方法 基于tess4j识别验证码 添加Cookie 利用SessionStorage或者LocalStorage绕过验证 1. 基于tess4j识别验证码 1)pom.xml添加tess4j < dependency > < groupId > net . sourceforge . tess4j < / groupId > < artifactId > tess4j < / artifactId > < version > 4.5 .2 < / version > < / dependency > 2)对于tess4j 4.5.2版本,windows平台下需要安装Microsoft Visual C++ 2015-2019 Redistributable,否则会报错 Exception in thread “main” java.lang.UnsatisfiedLinkError: 找不到指定模块 3)下载文字库放到指定文件夹tessdata下 4)具体实现代码: public static void main ( String [ ] args ) throws IOException { //初始化driver ChromeOptions chromeOptions = new ChromeOptions ( ) ; driver = new