Selenium中执行Javascript方法如下

if (driver instanceof JavascriptExecutor) {
((JavascriptExecutor) driver)
.executeScript("alert('hello world');");
}