使用JavascriptExecutor在selenium中生成javascript警报
尝试过的事情使用JavascriptExecutor在selenium中生成javascript警报,javascript,java,selenium,Javascript,Java,Selenium,尝试过的事情 String selectBook="abc"; String script="alert('"+selectBook+"' book does not exist');"; JavascriptExecutor js=(JavascriptExecutor)driver; js.executeScript(script); 我想在提示消息的同时,提示alert中变量select book的值 单引号关闭不正确 String script="alert('"+sele
String selectBook="abc";
String script="alert('"+selectBook+"' book does not exist');";
JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript(script);
我想在提示消息的同时,提示alert中变量select book的值 单引号关闭不正确
String script="alert('"+selectBook+" book does not exist');";
希望这对您有所帮助…打印“字符串脚本”。。。也许您会注意到一些问题。打印脚本值会给出:警报('abc'书本不存在');您好@Grishma上面的解决方案对您有帮助吗??