1 /* 2 * Copyright (C) 2010-2014 Hamburg Sud and the contributors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.aludratest.service.gui.web; 17 18 import org.aludratest.impl.log4testing.TechnicalLocator; 19 import org.aludratest.service.gui.GUIInteraction; 20 import org.aludratest.service.locator.element.GUIElementLocator; 21 import org.aludratest.service.locator.element.XPathLocator; 22 import org.aludratest.testcase.data.ParamConverter; 23 import org.w3c.dom.NodeList; 24 25 /** 26 * Specialization of the {@link GUIInteraction} interface 27 * which adds features specific for Web GUIs. 28 * @author Volker Bergmann 29 */ 30 public interface WebGUIInteraction extends GUIInteraction { 31 32 /** Opens the main URL of the Application Unter Test (configuration property: <code>url.of.aut</code>) in a new browser window 33 * and waits until the page is fully loaded. This method has to be called before most methods of the <code>check()</code>, 34 * <code>perform()</code> and <code>verify()</code> objects can be used. */ 35 public void open(); 36 37 /** 38 * Refreshes the page of the currently selected window and waits until the 39 * page is fully loaded. 40 */ 41 void refresh(); 42 43 /** 44 * Maximizes the currently selected window. 45 */ 46 void windowMaximize(); 47 48 /** 49 * Gives focus to the currently selected window. 50 */ 51 void windowFocus(); 52 53 /** Tells the Selenium server to add the specified key and value as a custom outgoing request header. This only works if the 54 * browser is configured to use the built in Selenium proxy. 55 * @param key the header name 56 * @param value the header value */ 57 void addCustomHttpHeaderCommand(String key, @ParamConverter(HttpHeaderFormat.class) String value); 58 59 /** Switches to the given iframe element of the current web page in the current window, or switches back to default content. 60 * 61 * @param iframeLocator Locator which uniquely identifies the inner frame to switch to. Use <code>null</code> to switch back 62 * to default content. */ 63 void switchToIFrame(@TechnicalLocator GUIElementLocator iframeLocator); 64 65 /** Does the same like {@link #evalXPath(String)} does. 66 * @param locator whose XPath expression will be taken and evaluated 67 * @return NodeList object containing XPath evaluation result */ 68 NodeList evalXPath(@TechnicalLocator XPathLocator locator); 69 70 /** Evaluates arbitrary XPath and outputs its result as NodeList object. 71 * @param xpath XPath expression to be executed 72 * @return NodeList object containing XPath evaluation result */ 73 NodeList evalXPath(@TechnicalLocator String xpath); 74 75 /** Evaluates arbitrary XPath and outputs its result as String. 76 * @param xpath XPath expression to be executed 77 * 78 * @return String containing XPath evaluation result */ 79 String evalXPathAsString(@TechnicalLocator String xpath); 80 81 }