1 5 package org.exoplatform.test.web.unit; 6 7 import org.exoplatform.test.web.*; 8 import com.meterware.httpunit.*; 9 15 public class ClickURLLinkUnit extends WebUnit { 16 protected String url_ ; 17 18 public ClickURLLinkUnit(String name, String description) { 19 super(name, description) ; 20 } 21 22 public ClickURLLinkUnit setURL(String text) { 23 url_ = text ; 24 return this ; 25 } 26 27 public WebResponse execute(WebResponse previousResponse, WebTable block, 28 ExoWebClient client) throws Exception { 29 String name = client.getName() ; 30 String url = url_.replaceAll("#\\{client.name\\}", name) ; 31 WebLink link = Util.findLinkWithURL(previousResponse, block, url); 32 if(link != null) return link.click() ; 33 throw new Exception ("Cannot find the link " + url_ + ", Block ID " + getBlockId()) ; 34 } 35 36 public String getActionDescription() { 37 return "This web unit look for the link with the partial url '..." + url_ + "...' and click on it"; 38 } 39 } | Popular Tags |