需要使用Javascriptexecuter调用具有两个参数的xx.js方法,该方法位于网络浏览器的bundled.js中
代码试用:
public void callingJSmethodfrombrowser(String id)
{
String notifnumber = id.substring(0,9);
//var id1 = id;
System.out.println("notif number: "+notifnumber);
JavascriptExecutor javascriptExecutor =(JavascriptExecutor)webDriver;
javascriptExecutor.executeScript("document.xyztest(“+id+","+notifnumber+")");
}
public void getFile
{
Int id=“someidneedtobegiven-asd122-ghhher” callingJSmethodfrombrowser(id);
}