use of com.gargoylesoftware.htmlunit.html.HtmlTableDataCell in project htmlunit by HtmlUnit.
the class HTMLElement method getOffsetParentInternal.
private Object getOffsetParentInternal(final boolean returnNullIfFixed) {
DomNode currentElement = getDomNodeOrDie();
if (currentElement.getParentNode() == null) {
return null;
}
final HTMLElement htmlElement = currentElement.getScriptableObject();
if (returnNullIfFixed && "fixed".equals(htmlElement.getStyle().getStyleAttribute(StyleAttributes.Definition.POSITION, true))) {
return null;
}
final ComputedCSSStyleDeclaration style = htmlElement.getWindow().getComputedStyle(htmlElement, null);
final String position = style.getPositionWithInheritance();
final boolean staticPos = "static".equals(position);
while (currentElement != null) {
final DomNode parentNode = currentElement.getParentNode();
if (parentNode instanceof HtmlBody || (staticPos && parentNode instanceof HtmlTableDataCell) || (staticPos && parentNode instanceof HtmlTable)) {
return parentNode.getScriptableObject();
}
if (parentNode != null && parentNode.getScriptableObject() instanceof HTMLElement) {
final HTMLElement parentElement = parentNode.getScriptableObject();
final ComputedCSSStyleDeclaration parentStyle = parentElement.getWindow().getComputedStyle(parentElement, null);
final String parentPosition = parentStyle.getPositionWithInheritance();
if (!"static".equals(parentPosition)) {
return parentNode.getScriptableObject();
}
}
currentElement = currentElement.getParentNode();
}
return null;
}
use of com.gargoylesoftware.htmlunit.html.HtmlTableDataCell in project htmlunit by HtmlUnit.
the class GWT250Test method mail.
/**
* @throws Exception if an error occurs
*/
@Test
public void mail() throws Exception {
final HtmlPage page = loadGWTPage("Mail", null, "//div[@class='MGJ']");
assertSame(page.getEnclosingWindow(), page.getWebClient().getCurrentWindow());
final HtmlDivision cell = page.getFirstByXPath("//div[@class='MGJ']");
assertElementValue(cell, "Welcome back, foo@example.com");
final String[] selectedRow = { "markboland05", "mark@example.com", "URGENT -[Mon, 24 Apr 2006 02:17:27 +0000]" };
final List<?> selectedRowCells = page.getByXPath("//tr[@class='MKI']/td");
assertEquals(selectedRow.length, selectedRowCells.size());
for (int i = 0; i < selectedRow.length; i++) {
final HtmlTableDataCell selectedRowCell = (HtmlTableDataCell) selectedRowCells.get(i);
assertElementValue(selectedRowCell, selectedRow[i]);
}
verifyStartMailBody(page, "Dear Friend,", "I am Mr. Mark Boland the Bank Manager of ABN AMRO BANK 101 Moorgate, London, EC2M 6SB.");
// click on email from Hollie Voss
final HtmlElement elt = page.getFirstByXPath("//td[text() = 'Hollie Voss']");
final HtmlPage page2 = elt.click();
assertSame(page, page2);
verifyStartMailBody(page, ">> Componentes e decodificadores; confira aqui;", "http://br.geocities.com/listajohn/index.htm", "THE GOVERNING AWARD");
}
use of com.gargoylesoftware.htmlunit.html.HtmlTableDataCell in project htmlunit by HtmlUnit.
the class GWT250Test method dynaTable.
/**
* @throws Exception if an error occurs
*/
@Test
public void dynaTable() throws Exception {
startWebServer("src/test/resources/libraries/GWT/" + getDirectory() + "/DynaTable", new String[] { "src/test/resources/libraries/GWT/" + getDirectory() + "/gwt-servlet.jar" });
final WebClient client = getWebClient();
final String url = URL_FIRST + "DynaTable.html";
final HtmlPage page = client.getPage(url);
client.waitForBackgroundJavaScriptStartingBefore(2000);
final String[] firstRow = { "Inman Mendez", "Majoring in Phrenology", "Mon 9:45-10:35, Tues 2:15-3:05, Fri 8:45-9:35, Fri 9:45-10:35" };
final List<?> detailsCells = page.getByXPath("//table[@class='table']//tr[2]/td");
assertEquals(firstRow.length, detailsCells.size());
for (int i = 0; i < firstRow.length; i++) {
final HtmlTableDataCell cell = (HtmlTableDataCell) detailsCells.get(i);
assertElementValue(cell, firstRow[i]);
}
}
Aggregations