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