Reputation: 303
Things tried
String selectBook="abc";
String script="alert('"+selectBook+"' book does not exist');";
JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript(script);
I want to alert the value of variable select book in alert along with the message.
Upvotes: 1
Views: 2153
Reputation: 3021
The single quotes are closed incorrectly
String script="alert('"+selectBook+" book does not exist');";
Hope this helps you...
Upvotes: 1