问题:selenium-java版本为4.1.4、4.8.2 + Java 8 运行时报Invalid Status code=403 text=Forbidden
运行代码:
public class RemoteTest { public ChromeOptions options ; public WebDriver driver; @Test public void remoteTest(){ options = new ChromeOptions(); options.addArguments("--remote-allow-origins=*"); options.setExperimentalOption("debuggerAddress","localhost:9222"); driver = new ChromeDriver(options); driver.get("https://www.baidu.com"); driver.findElement(By.id("kw")).sendKeys("李晓明"); driver.findElement(By.id("su")).click(); } }
报错如下:
解决办法:(参考:https://stackoverflow.com/questions/75680149/unable-to-establish-websocket-connection/75703971#75703971)
目前我的浏览器是 123.0.6312.86 + jdk 1.8
感觉降低selenium-java版本或降低浏览器的版本号(如 105)都不会出现问题
标签:Status,code,浏览器,text,driver,public,options,selenium From: https://www.cnblogs.com/momoyou/p/18127707