Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
PreviewBox | 27 | 10 | 0% | 2 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.flamingo.test.po; | |
21 | ||
22 | import java.util.List; | |
23 | ||
24 | import org.openqa.selenium.By; | |
25 | import org.openqa.selenium.WebElement; | |
26 | ||
27 | public class PreviewBox extends CSSGetterPage | |
28 | { | |
29 | 3 | @Override |
30 | protected String getElementCSSValue(final By locator, String attribute) | |
31 | { | |
32 | 3 | try { |
33 | 3 | getDriver().switchTo().frame("iframe"); |
34 | 3 | WebElement element = getDriver().findElement(locator); |
35 | 3 | return element.getCssValue(attribute); |
36 | } finally { | |
37 | 3 | getDriver().switchTo().defaultContent(); |
38 | } | |
39 | } | |
40 | ||
41 | 2 | public boolean hasError() |
42 | { | |
43 | 2 | try { |
44 | 2 | getDriver().switchTo().frame("iframe"); |
45 | 2 | List<WebElement> errors = getDriver().findElementsWithoutWaiting(By.className("less-error-message")); |
46 | 2 | return !errors.isEmpty(); |
47 | } finally { | |
48 | 2 | getDriver().switchTo().defaultContent(); |
49 | } | |
50 | } | |
51 | } |