Commit b98d9476b548bb1131102cbd5b3d4ad0ebfb6a5e
1 parent
dec22821
Implemented methods to obtain data from dataTable and schedule.
Showing
1 changed file
with
24 additions
and
4 deletions
... | ... | @@ -6,7 +6,10 @@ import com.gargoylesoftware.htmlunit.html.DomNodeList; |
6 | 6 | import com.gargoylesoftware.htmlunit.html.HtmlElement; |
7 | 7 | import com.gargoylesoftware.htmlunit.html.HtmlInput; |
8 | 8 | import com.gargoylesoftware.htmlunit.html.HtmlPage; |
9 | +import com.gargoylesoftware.htmlunit.html.HtmlSpan; | |
10 | +import com.gargoylesoftware.htmlunit.html.HtmlTable; | |
9 | 11 | import com.gargoylesoftware.htmlunit.html.HtmlTableCell; |
12 | +import com.gargoylesoftware.htmlunit.html.HtmlTableRow; | |
10 | 13 | |
11 | 14 | import java.io.IOException; |
12 | 15 | import java.util.ArrayList; |
... | ... | @@ -81,10 +84,12 @@ public class WebClientUtils { |
81 | 84 | @SuppressWarnings("unchecked") |
82 | 85 | final DomNodeList<HtmlElement> suggestionRows = suggestElement.getElementsByTagName("tr"); |
83 | 86 | for (HtmlElement row : suggestionRows) { |
84 | - @SuppressWarnings("unchecked") | |
85 | - final DomNodeList<HtmlElement> cells = row.getElementsByTagName("td"); | |
86 | - final HtmlTableCell cell = (HtmlTableCell) cells.get(column + 1); | |
87 | - suggestions.put(cell.asText(), cell); | |
87 | + if (!row.getId().endsWith("NothingLabel")) { | |
88 | + @SuppressWarnings("unchecked") | |
89 | + final DomNodeList<HtmlElement> cells = row.getElementsByTagName("td"); | |
90 | + final HtmlTableCell cell = (HtmlTableCell) cells.get(column + 1); | |
91 | + suggestions.put(cell.asText(), cell); | |
92 | + } | |
88 | 93 | } |
89 | 94 | return suggestions; |
90 | 95 | } |
... | ... | @@ -146,4 +151,19 @@ public class WebClientUtils { |
146 | 151 | ((HtmlInput) page.getElementById(colorPicker.getId() + "-colorPicker-rgb-b")).setValueAttribute(Integer.toString(blue)); |
147 | 152 | page.getElementById(colorPicker.getId() + "-colorPicker-popup").getHtmlElementsByTagName("button").get(0).click(); |
148 | 153 | } |
154 | + | |
155 | + @SuppressWarnings("unchecked") | |
156 | + public static List<HtmlTableRow> getTableRows(HtmlTable table) { | |
157 | + return (List<HtmlTableRow>) table.getByXPath(".//*[contains(@class,'rich-table-row')]"); | |
158 | + } | |
159 | + | |
160 | + @SuppressWarnings("unchecked") | |
161 | + public static List<String> getScheduleEventTitles(HtmlElement schedule) { | |
162 | + final List<HtmlSpan> titleElements = (List<HtmlSpan>) schedule.getByXPath(".//*[@class='fc-event-title']"); | |
163 | + List<String> titles = new ArrayList<String>(titleElements.size()); | |
164 | + for (HtmlSpan o : titleElements) { | |
165 | + titles.add(o.asText()); | |
166 | + } | |
167 | + return titles; | |
168 | + } | |
149 | 169 | } | ... | ... |
Please
register
or
login
to post a comment