我正在制作一个需要自动登录的应用程序。为此,我使用selenium打开一个新的选项卡,并通过Web剪贴获取用户和密码,但我得到了一个java.net。未知协议:chrome当tryng得到源代码。我怎么能解决这个问题?thxx
System.setProperty("webdriver.gecko.driver", ".\\driver/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("chrome://settings/passwords?search=contra");
try {
URL dirURL = new URL("chrome://settings/passwords?search=contra");
InputStream entry = dirURL.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(entry));
String line = "";
String sourceCode = "";
do {
sourceCode += line + "\n";
line = reader.readLine();
} while (line != null);
System.out.println(sourceCode);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
1条答案
按热度按时间bmp9r5qi1#
使用时:
所以在开头就改为:
您需要提供: