Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Some how managed to write code in java using StringBuffer :)</p> <p>Instead of storing the result of first block and process next I have created a string command based on the searchString as below and finally fire the newly created command and verified the answer.</p> <p>Like whenevenever AND comes in searchString we insert &amp;&amp; operator and for OR || operator. </p> <pre><code>String[] arrSearch=searchString.split("\\s"); StringBuffer sb = new StringBuffer(); boolean skipFlag = false; for(int i=0;i&lt;arrSearch.length;i++){ System.out.println(arrSearch[i]); if(!skipFlag &amp;&amp; arrSearch[i].startsWith("\"")){ skipFlag = true; continue; }else if(skipFlag){ if(arrSearch[i].endsWith("\"")){ skipFlag = false; continue; }else{ continue; } }else if(arrSearch[i].startsWith("(")){ String temp = arrSearch[i].substring(1); sb.append("(selenium.isTextPresent(" + temp + ")" + " "); }else if(arrSearch[i].startsWith(")")){ String temp = arrSearch[i].substring(0,arrSearch[i].length()-1); sb.append("selenium.isTextPresent(" + temp + "))" + " "); }else if(arrSearch[i].equalsIgnoreCase("AND")){ sb.append("&amp;&amp;" + " "); }else if(arrSearch[i].equalsIgnoreCase("OR")){ sb.append("||" + " "); }else if(arrSearch[i].equalsIgnoreCase("NOT")){ sb.append("!"); }else if(arrSearch[i].endsWith("*")){ String temp = arrSearch[i].substring(0,arrSearch[i].length()-1); sb.append("selenium.isTextPresent(\"//*[contains('" + temp + "')]\")" + " "); }else{ sb.append("selenium.isTextPresent(" + arrSearch[i] + ")" + " "); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload