Selenium Webdriver Java.io.IOException:状态代码无效 = 403 text=Forbidden
2024-03-04 09:50:51
michael007js
107
Selenium Webdriver Java.io.IOException:状态代码无效 = 403 text=Forbidden
解决方法是将 chromedriver 选项"--remote-allow-origins=*"添加到驱动程序实例
ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addArguments("--headless"); chromeOptions.addArguments("--no-sandbox"); chromeOptions.addArguments("--disable-dev-shm-usage"); chromeOptions.addArguments("--remote-allow-origins=*"); WebDriver driver = new ChromeDriver(chromeOptions);