当前位置: 首页>>代码示例>>Java>>正文


Java ElementNotFoundException类代码示例

本文整理汇总了Java中com.gargoylesoftware.htmlunit.ElementNotFoundException的典型用法代码示例。如果您正苦于以下问题:Java ElementNotFoundException类的具体用法?Java ElementNotFoundException怎么用?Java ElementNotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ElementNotFoundException类属于com.gargoylesoftware.htmlunit包,在下文中一共展示了ElementNotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void execute(Context context)
{
	LoggerFactory.getLogger(SelectDropdown.class).debug("Executing action: " + this);
	try
	{
		HtmlSelect select = context.getXPathProcessor().getSingleElementOfType(Util.getCurrentPage(context), Util.replacePlaceholders(path, context), HtmlSelect.class);
		HtmlOption option = select.getOptionByValue(Util.replacePlaceholders(value, context));
		select.setSelectedAttribute(option, true);
	}
	catch(ElementNotFoundException e)
	{
		throw new RuntimeException("No option found for value " + value);
	}
}
 
开发者ID:sropelato,项目名称:Fetchino,代码行数:19,代码来源:SelectDropdown.java

示例2: updateResources

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
private void updateResources(HtmlPage page) throws ElementNotFoundException {
	try {
		NumberFormat fmt = NumberFormat.getNumberInstance(Locale.GERMANY);

		final HtmlSpan htmlMetal = page.getHtmlElementById("resources_metal");
		resources[METAL] = fmt.parse(htmlMetal.asText()).intValue();

		final HtmlSpan htmlCrystal = page.getHtmlElementById("resources_crystal");
		resources[CRYSTAL] =  fmt.parse(htmlCrystal.asText()).intValue();

		final HtmlSpan htmlDeuterium = page.getHtmlElementById("resources_deuterium");
		resources[DEUTERIUM] = fmt.parse(htmlDeuterium.asText()).intValue();

		final HtmlSpan htmlEnergy = page.getHtmlElementById("resources_energy");
		resources[ENERGY] = fmt.parse(htmlEnergy.asText()).intValue();
	} catch (ParseException exc) {
	}
}
 
开发者ID:vcosta,项目名称:ogamemafia,代码行数:19,代码来源:Planet.java

示例3: waitForElement

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
public void waitForElement(WebElement element,int timeOutInSeconds) {
	WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
	wait.ignoring(NoSuchElementException.class);
	wait.ignoring(ElementNotVisibleException.class);
	wait.ignoring(StaleElementReferenceException.class);
	wait.ignoring(ElementNotFoundException.class);
	wait.pollingEvery(250,TimeUnit.MILLISECONDS);
	wait.until(elementLocated(element));
}
 
开发者ID:rahulrathore44,项目名称:SeleniumCucumber,代码行数:10,代码来源:PageBase.java

示例4: getElement

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
public WebElement getElement(final By by, final String elementName) {
    WebElement element = null;

    try {
        element = driver.findElement(by);
    } catch (final ElementNotFoundException e) {
        TestLogging.errorLogger(elementName +
                " is not found with locator - " + by.toString());
        throw e;
    }

    return element;
}
 
开发者ID:tarun3kumar,项目名称:seleniumtestsframework,代码行数:14,代码来源:PageObject.java

示例5: editThenCancel

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
private void editThenCancel(final String name) throws Exception {
  final String flagText = "Should not be saved.";
  HtmlPage editPage = clickEditLink(getWikiPage(name));
  HtmlForm form = editPage.getFormByName(ID_EDIT_FORM);
  form.getTextAreaByName("content").setText(flagText);
  HtmlPage viewPage = (HtmlPage) form.getButtonByName("unlock").click();
  assertFalse(viewPage.asText().contains(flagText));
  try {
    viewPage.getFormByName(ID_EDIT_FORM);
    fail("Should be back to view page, not edit form.");
  }
  catch (ElementNotFoundException ignore) {
  }
  assertEquals("Should not be present.", 0,viewPage.getByXPath("id('lockedInfo')").size());
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:16,代码来源:TestEditing.java

示例6: hasErrorMessage

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
protected boolean hasErrorMessage(final HtmlPage page) throws Exception {
  try {
    return page.getByXPath("id('flash')").size() > 0;
  }
  catch (ElementNotFoundException e) {
    return false;
  }
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:9,代码来源:WebTestSupport.java

示例7: testRenameLinkNotAvailableForNonExistantPages

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
public void testRenameLinkNotAvailableForNonExistantPages() throws Exception {
  HtmlPage page = getWikiPage(uniqueWikiPageName("RenameLinkTest"));
  try {
    page.getAnchorByName("rename");
    fail();
  }
  catch (ElementNotFoundException expected) {
  }
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:10,代码来源:TestRename.java

示例8: testCopyLinkNotAvailableForNonExistantPages

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
public void testCopyLinkNotAvailableForNonExistantPages() throws Exception {
  HtmlPage page = getWikiPage(uniqueWikiPageName("CopyLinkTest"));
  try {
    page.getAnchorByName("copy");
    fail();
  }
  catch (ElementNotFoundException expected) {
  }
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:10,代码来源:TestCopy.java

示例9: findUsernameField

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
static private HtmlTextInput findUsernameField(HtmlPage aPage) {
	HtmlTextInput result = null;
	try {
		result = aPage.getElementByName("username");
	} catch (ElementNotFoundException e) {
	}
	return result;
}
 
开发者ID:gemarcano,项目名称:SWEN-Fuzzer,代码行数:9,代码来源:PageLogin.java

示例10: findPasswordField

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
static private HtmlPasswordInput findPasswordField(HtmlPage aPage) {
	HtmlPasswordInput result = null;
	try {
		result = aPage.getElementByName("password");
	} catch (ElementNotFoundException e) {
	}
	return result;
}
 
开发者ID:gemarcano,项目名称:SWEN-Fuzzer,代码行数:9,代码来源:PageLogin.java

示例11: logOut

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
@Before
public void logOut() throws IOException, InterruptedException {
    
    // wait for server to come up
    Thread.sleep(2000);
    
    // make sure we are logged out
    HtmlPage homePage = webClient.getPage(getBaseUri());
    try {
        homePage.getAnchorByHref("/logout").click();
    }
    catch (ElementNotFoundException exc) {
        // ignore
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.shiro,代码行数:16,代码来源:JspBundleTest.java

示例12: logOut

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
@Before
public void logOut() throws IOException, InterruptedException {

    // wait for server to come up
    Thread.sleep(2000);

    // make sure we are logged out
    HtmlPage homePage = webClient.getPage(getBaseUri());
    try {
        homePage.getAnchorByHref("/logout").click();
    }
    catch (ElementNotFoundException exc) {
        // ignore
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.shiro,代码行数:16,代码来源:Jetty9JspBundleTest.java

示例13: updateResource

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
void updateResource(HtmlPage page) throws ElementNotFoundException {
	updateResources(page);
	
	update(page, this.building, resourceNames);
}
 
开发者ID:vcosta,项目名称:ogamemafia,代码行数:6,代码来源:Planet.java

示例14: updateStation

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
void updateStation(HtmlPage page) throws ElementNotFoundException {
	updateResources(page);

	update(page, this.building, stationNames);
}
 
开发者ID:vcosta,项目名称:ogamemafia,代码行数:6,代码来源:Planet.java

示例15: updateDefense

import com.gargoylesoftware.htmlunit.ElementNotFoundException; //导入依赖的package包/类
void updateDefense(HtmlPage page) throws ElementNotFoundException {
	updateResources(page);

	update(page, this.shipyard, defenseNames);
}
 
开发者ID:vcosta,项目名称:ogamemafia,代码行数:6,代码来源:Planet.java


注:本文中的com.gargoylesoftware.htmlunit.ElementNotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。