我有一个代码库,部署在服务器中,除了上传war文件之外我没有任何访问权限。我已经在本地使用apache tomcat 7测试了应用程序,它运行得很好。
我在JAVA中有一个触发远程Web浏览器实例的代码,在本地部署时效果很好但是当我将war文件上传到服务器时,我得到一个异常,如下图所示。
nodeIP = "10.52.239.111";
driver = new RemoteWebDriver(new URL(Node), capability);
部署战争的服务器的IP地址为" 172.32.xxx.xxx"
我得到了 org.openqa.selenium.UnsupportedCommandException 的例外我搜索了它,发现它指向的位置有一些线程,并要求更改主机文件的地址和所有。但我不明白如何解决我的情况,因为服务器配置根本无法由我控制。
DesiredCapabilities capability = DesiredCapabilities.firefox();
capability.setBrowserName("firefox");
FirefoxProfile fp = new FirefoxProfile();
fp.setPreference("browser.private.browsing.autostart", true);
//fp.setPreference(FirefoxProfile.ALLOWED_HOSTS_PREFERENCE, "localhost,localhost.localdomain");
String Node = "http://" + nodeIP + ":5556/wd/hub";
try {
driver = new RemoteWebDriver(new URL(Node), capability);
driver.manage().window().maximize();
} catch (Exception e) {
e.printStackTrace();
}