1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.jameleon.plugin.watij.tags;
21
22 import watij.elements.HtmlElement;
23 import watij.finders.Symbol;
24
25 /***
26 * Gets a link on the page and stores in the context.
27 *
28 * An example of its use might be to click on a link via its underlined text:
29 *
30 * <pre><source>
31 * <testcase xmlns="jelly:jameleon" xmlns:j="jelly:core">
32 * <watij-session baseUrl="http://jameleon.sourceforge.net" beginSession="true">
33 * <watij-link
34 * functionId="Get the 'some link' link"
35 * how="text"
36 * what="some link"
37 * contextVar="watijLink"/>
38 * <watij-click
39 * functionId="Click on the 'some link' link"
40 * element="${watijLink}"/>
41 * </watij-session>
42 * </testcase>
43 * </source></pre>
44 *
45 * Maybe there are several links with the same text and the one of interest has a and id attribute of '42'
46 * and you want to use a more specific context variable name like 'link42':
47 *
48 * <pre><source>
49 * <testcase xmlns="jelly:jameleon" xmlns:j="jelly:core">
50 * <watij-session baseUrl="http://jameleon.sourceforge.net" beginSession="true">
51 * <watij-link
52 * functionId="Get the link with the id of '42'"
53 * how="id"
54 * what="42"
55 * contextVar="link42"/>
56 * <watij-click
57 * functionId="Click on the link"
58 * element="${link42}"/>
59 * </watij-session>
60 * </testcase>
61 * </source></pre>
62 *
63 * See the javadocs on watij's {@link watij.finders.SymbolFactory SymbolFactory} for a complete list of supported symbols.
64 * @jameleon.function name="watij-link" type="action"
65 */
66 public class WatijLinkTag extends AbstractWatijGetTag{
67
68 public HtmlElement getHtmlElement(Symbol how, String what) throws Exception{
69 return ie().link(how, what);
70 }
71
72 public String getTagName(){
73 return "Link";
74 }
75 }