在Java中,final关键字似乎将构造与初始化分开,这意味着以与Arrays类似的方式阻止对象的内存使用.
如果我有一个非递归的对象层次结构,并且所有字段都是最终的,那么该内存只需要分配一次,并且也可以连续地为缓存分配.JVM实际上是这样做的吗?如果不是,为什么不呢?
有谁知道如何禁用它?或者如何从已自动接受的警报中获取文本?
这段代码需要工作,
driver.findElement(By.xpath("//button[text() = \"Edit\"]")).click();//causes page to alert() something
Alert alert = driver.switchTo().alert();
alert.accept();
return alert.getText();
Run Code Online (Sandbox Code Playgroud)
但反而给出了这个错误
No alert is present (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.14 seconds
Run Code Online (Sandbox Code Playgroud)
我正在使用FF 20和Selenium 2.32