selenium FAQ:怎么样调用Javascript? Posted on 2012-10-12 Edited on 2019-12-17 In selenium Views: selenium自动化开发中,难免需要用到直接调用javascript,怎么用呢?123WebDriver driver; // Assigned elsewhereJavascriptExecutor js = (JavascriptExecutor) driver;js.executeScript("return document.title"); 直接将driver强制转化为JavascriptExecutor,然后执行javascript即可。