我正在编写一个程序,我正在尝试在当前目录中创建一个新的文本文件,然后写一个字符串给它.但是,在尝试创建文件时,这段代码:
//Create the output text file.
File outputText = new File(filePath.getParentFile() + "\\Decrypted.txt");
try
{
outputText.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
给我这个错误信息:
java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)
at code.Crypto.decrypt(Crypto.java:55)
at code.Crypto.main(Crypto.java:27)
Run Code Online (Sandbox Code Playgroud)
因此,我无法写入文件,因为它自然不存在.我在这做错了什么?
我正在尝试将一些Selenium测试转换FirefoxDriver为MarionetteDriver,但我遇到了有关PKI的问题.到目前为止,我的解决方案是使用各种Firefox配置文件,这些配置文件只有一个自定义PKI并自动选择用于登录目的.但是,似乎MarionetteDriver构造函数无法使用自定义配置文件启动Firefox.我该如何解决?
我在Python中通过让Python连接到Marionette之前启动Firefox来解决这个问题,但我不知道Selenium WebDriver是否具备此功能.