我尝试执行javascript以在selenium webdriver脚本中附加一些代码。但是我收到以下错误:
)?缺少synthax
以下是我的javascript
String item1= $("<div id=Unique1 class='dojoItem Name' style=padding:.5em;`display:inline-block;width:16em;overflow:hidden;vertical-align:bottom;>filter_info_ALL_DATA_DOWN</div>").appendTo('#select');
这是我的webdriver代码:
openServiceFlows();
driver.findElement(By.id("test")).click();
driver.findElement(By.id("open")).sendKeys("allow_ALL_DATA111");
driver.findElement(By.id("id")).sendKeys("102");
executeJavascript("item1");
以下用于执行我的javascript
protected void executeJavascript(String script){
JavascriptExecutor je = (JavascriptExecutor) driver;
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
e.printStackTrace();
}
je.executeScript(script);
}