• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ElementNotVisibleException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: doClick

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
private void doClick() {

        try {
            new RealHtmlElementState(this).waitToBecomeExisting();
            WebElement element = RealHtmlElementLocator.findElement(this);
            try {
                element.click();
            } catch (ElementNotVisibleException enve) {
                if (!UiEngineConfigurator.getInstance().isWorkWithInvisibleElements()) {
                    throw enve;
                }
                ((JavascriptExecutor) webDriver).executeScript("arguments[0].click()", element);
            }
        } catch (Exception e) {
            ((AbstractRealBrowserDriver) super.getUiDriver()).clearExpectedPopups();
            throw new SeleniumOperationException(this, "click", e);
        }

        UiEngineUtilities.sleep();

        ((AbstractRealBrowserDriver) super.getUiDriver()).handleExpectedPopups();
    }
 
开发者ID:Axway,项目名称:ats-framework,代码行数:23,代码来源:RealHtmlButton.java


示例2: clickDialogFooterButton

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
/**
 * Clicks button at the bottom of edit Window and expect for dialog to disappear.
 *
 * @param buttonText button label
 * @return Returns this dialog instance.
 */
public AemDialog clickDialogFooterButton(final String buttonText) {
  final WebElement footerButton = getFooterButtonWebElement(buttonText);

  bobcatWait.withTimeout(Timeouts.BIG).until((ExpectedCondition<Object>) input -> {
    try {
      footerButton.click();
      footerButton.isDisplayed();
      return Boolean.FALSE;
    } catch (NoSuchElementException | StaleElementReferenceException
        | ElementNotVisibleException e) {
      LOG.debug("Dialog footer button is not available: {}", e);
      return Boolean.TRUE;
    }
  }, 2);
  bobcatWait.withTimeout(Timeouts.MEDIUM).until(CommonExpectedConditions.noAemAjax());
  return this;
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:24,代码来源:AemDialog.java


示例3: findElements

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
/**
 * Overridden webDriver find Elements with proper wait.
 */
@Override
public List<WebElement> findElements(By locator) {

	try {
		(new WebDriverWait(appiumDriver, maxWaitTime))
				.until(ExpectedConditions
						.presenceOfAllElementsLocatedBy(locator));
	} catch (ElementNotVisibleException e) {
		Reporter.log("Element not found: " + locator.toString());
		captureScreenshot();
		throw e;
	}
	return appiumDriver.findElements(locator);

}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:19,代码来源:NativeAppDriver.java


示例4: setActive

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
/**
 * After the tab is set to active will wait 300ms to make sure tab is rendered
 *
 * @return true or false
 */
public boolean setActive() {
    String baseTabPath = "//*[" + getPathBuilder().getBasePath() + "]";
    String titlePath = baseTabPath + getTitlePath();
    WebLocator titleElement = new WebLocator(getPathBuilder().getContainer()).setElPath(titlePath).setInfoMessage(getPathBuilder().getText() + " Tab");
    LOGGER.info("setActive : " + toString());
    boolean activated;
    try {
        activated = titleElement.click();
    } catch (ElementNotVisibleException e) {
        LOGGER.error("setActive Exception: " + e.getMessage());
        activated = setActiveWithExtJS();
    }
    if (activated) {
        Utils.sleep(300); // need to make sure this tab is rendered
    }
    return activated;
}
 
开发者ID:sdl,项目名称:Testy,代码行数:23,代码来源:TabPanel.java


示例5: setFileInputValue

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
/**
*
* @param webDriver {@link WebDriver} instance
* @param value the file input value to set
*/
protected void setFileInputValue( WebDriver webDriver, String value ) {

    String locator = this.getElementProperties()
                         .getInternalProperty(HtmlElementLocatorBuilder.PROPERTY_ELEMENT_LOCATOR);

    String css = this.getElementProperty("_css");

    WebElement element = null;

    if (!StringUtils.isNullOrEmpty(css)) {
        element = webDriver.findElement(By.cssSelector(css));
    } else {
        element = webDriver.findElement(By.xpath(locator));
    }

    try {
        element.sendKeys(value);
    } catch (ElementNotVisibleException enve) {

        if (!UiEngineConfigurator.getInstance().isWorkWithInvisibleElements()) {
            throw enve;
        }
        // try to make the element visible overriding some CSS properties
        // but keep in mind that it can be still invisible using another CSS and/or JavaScript techniques
        String styleAttrValue = element.getAttribute("style");
        JavascriptExecutor jsExec = (JavascriptExecutor) webDriver;
        try {
            jsExec.executeScript("arguments[0].setAttribute('style', arguments[1]);",
                                 element,
                                 "display:'block'; visibility:'visible'; top:'auto'; left:'auto'; z-index:999;"
                                          + "height:'auto'; width:'auto';");
            element.sendKeys(value);
        } finally {
            jsExec.executeScript("arguments[0].setAttribute('style', arguments[1]);", element,
                                 styleAttrValue);
        }

    } catch (InvalidElementStateException e) {
        throw new SeleniumOperationException(e.getMessage(), e);
    }
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:47,代码来源:HtmlFileBrowse.java


示例6: openByContextMenu

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
private void openByContextMenu(final WebElement element) {
  waitForComponentOnParsys();
  bobcatWait.withTimeout(Timeouts.BIG).until((ExpectedCondition<Object>) input -> {
    try {
      aemContextMenu.open(element);
      aemContextMenu.clickOption(MenuOption.EDIT);
    } catch (NoSuchElementException | StaleElementReferenceException
        | ElementNotVisibleException e) {
      LOG.debug("Dialog open element is not available: {}", e);
    }
    return isVisible();
  }, 5);
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:14,代码来源:AemDialog.java


示例7: clickByImage

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
/**
 * clickByImage is the main method that you should be using to tap on elements on screen using an image.
 * @param targetImgPath takes path to the screenshot of an element that you want to find.
 */
public void clickByImage(String targetImgPath) {
    Point2D coords = getCoords(takeScreenshot(), targetImgPath);
    if ((coords.getX() >= 0) && (coords.getY() >= 0)) {
        driver.tap(1, (int) coords.getX(), (int) coords.getY(), 100);
    } else {
        throw new ElementNotVisibleException("Element not found - " + targetImgPath);
    }
}
 
开发者ID:Simon-Kaz,项目名称:AppiumFindByImage,代码行数:13,代码来源:OCR.java


示例8: longPressByImage

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
public void longPressByImage(String targetImgPath) {
    Point2D coords = getCoords(takeScreenshot(), targetImgPath);
    if ((coords.getX() >= 0) && (coords.getY() >= 0)) {
        TouchAction touchA = new TouchAction(driver);
        touchA.longPress((int) coords.getX(), (int) coords.getY(), 1000).release().perform();
    } else {
        throw new ElementNotVisibleException("Element not found - " + targetImgPath);
    }
}
 
开发者ID:Simon-Kaz,项目名称:AppiumFindByImage,代码行数:10,代码来源:OCR.java


示例9: signupUser

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
private void signupUser() {
    goToLogin();
    browser
            .fill("#email").with(FACEBOOK_USER_EMAIL)
            .fill("#pass").with(System.getenv("FACEBOOK_USER_PASSWORD"))
            .find("#loginbutton").click();
    browser.await().untilPage().isLoaded();

    // save browser? no!
    try {
        // try, because this is not checked for test users, because they are not asked
        final String selector = "#u_0_2";
        browser.await().atMost(10, TimeUnit.SECONDS).until(selector);
        browser.find(selector).click();
        browser.find("#checkpointSubmitButton").click();
        browser.await().untilPage().isLoaded();
    } catch (final NoSuchElementException nsee) {
        // mobile
    } catch(final ElementNotVisibleException enve) {
        // desktop
    } catch(final WebDriverException wde) {
        // something else
    }

    // check login layout
    checkLoginLayout();

    // confirm login
    browser
            .find("[name='__CONFIRM__']")
            .click();
    browser
            .await()
            .untilPage()
            .isLoaded();

}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:38,代码来源:FacebookOAuth2Test.java


示例10: waitForElement

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的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


示例11: getWait

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
private WebDriverWait getWait(int timeOutInSeconds,int pollingEveryInMiliSec) {
	oLog.debug("");
	WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
	wait.pollingEvery(pollingEveryInMiliSec, TimeUnit.MILLISECONDS);
	wait.ignoring(NoSuchElementException.class);
	wait.ignoring(ElementNotVisibleException.class);
	wait.ignoring(StaleElementReferenceException.class);
	wait.ignoring(NoSuchFrameException.class);
	return wait;
}
 
开发者ID:rahulrathore44,项目名称:SeleniumCucumber,代码行数:11,代码来源:WaitHelper.java


示例12: exitFromRoom

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
public void exitFromRoom(int pageIndex, String userName) {
  Browser userBrowser = getPage(getBrowserKey(pageIndex)).getBrowser();
  try {
    Actions actions = new Actions(userBrowser.getWebDriver());
    actions.click(findElement(userName, userBrowser, "buttonLeaveRoom")).perform();
    log.debug("'buttonLeaveRoom' clicked on in {}", userName);
  } catch (ElementNotVisibleException e) {
    log.warn("Button 'buttonLeaveRoom' is not visible. Session can't be closed");
  }
}
 
开发者ID:Kurento,项目名称:kurento-room,代码行数:11,代码来源:RoomClientBrowserTest.java


示例13: unsubscribe

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
public void unsubscribe(int pageIndex, int unsubscribeFromIndex) {
  String clickableVideoTagId = getBrowserVideoStreamName(unsubscribeFromIndex);
  selectVideoTag(pageIndex, clickableVideoTagId);

  WebDriver userWebDriver = getPage(getBrowserKey(pageIndex)).getBrowser().getWebDriver();
  try {
    userWebDriver.findElement(By.id("buttonDisconnect")).click();
  } catch (ElementNotVisibleException e) {
    String msg = "Button 'buttonDisconnect' is not visible. Can't unsubscribe from media.";
    log.warn(msg);
    fail(msg);
  }
}
 
开发者ID:Kurento,项目名称:kurento-room,代码行数:14,代码来源:RoomClientBrowserTest.java


示例14: selectVideoTag

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
public void selectVideoTag(int pageIndex, String targetVideoTagId) {
  WebDriver userWebDriver = getPage(getBrowserKey(pageIndex)).getBrowser().getWebDriver();
  try {
    WebElement element = userWebDriver.findElement(By.id(targetVideoTagId));
    Actions actions = new Actions(userWebDriver);
    actions.moveToElement(element).click().perform();
  } catch (ElementNotVisibleException e) {
    String msg = "Video tag '" + targetVideoTagId + "' is not visible, thus not selectable.";
    log.warn(msg);
    fail(msg);
  }
}
 
开发者ID:Kurento,项目名称:kurento-room,代码行数:13,代码来源:RoomClientBrowserTest.java


示例15: unpublish

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
protected void unpublish(int pageIndex) {
  WebDriver userWebDriver = getPage(getBrowserKey(pageIndex)).getBrowser().getWebDriver();
  try {
    userWebDriver.findElement(By.id("buttonDisconnect")).click();
  } catch (ElementNotVisibleException e) {
    log.warn("Button 'buttonDisconnect' is not visible. Can't unpublish media.");
  }
}
 
开发者ID:Kurento,项目名称:kurento-room,代码行数:9,代码来源:RoomClientBrowserTest.java


示例16: checkByValue

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
@Override
public void checkByValue(Element element, String value)
{
	WebElement parentWebEle = searchStrategyUtils.findStrategy(WebElement.class, element).search(element);
	if(parentWebEle == null)
	{
		logger.error(String.format("can not found element byText [%s].", value));
		return;
	}
	
	List<Locator> locatorList = element.getLocatorList();
	List<Locator> tmpList = new ArrayList<Locator>(locatorList);
	
	ElementSearchStrategy<WebElement> strategy = context.getBean("zoneSearchStrategy", ElementSearchStrategy.class);
	
	SeleniumValueLocator valueLocator = context.getBean(SeleniumValueLocator.class);
	valueLocator.setHostType("byTagName");
	valueLocator.setHostValue("input");
	
	locatorList.clear();
	locatorList.add(valueLocator);
	valueLocator.setValue(value);
	
	WebElement itemWebEle = null;
	try
	{
		if(strategy instanceof ParentElement)
		{
			((ParentElement) strategy).setParent(parentWebEle);
		}
		
		itemWebEle = strategy.search(element);
		if(itemWebEle != null)
		{
			if(!itemWebEle.isSelected())
			{
				itemWebEle.click();
			}
		}
	}
	catch(ElementNotVisibleException e)
	{
		e.printStackTrace();
		logger.error(String.format("Element [%s] click error, parent [%s], text [%s].",
				itemWebEle, element, value));
	}
	finally
	{
		//清空缓存
		locatorList.clear();
		locatorList.addAll(tmpList);
		
		if(strategy instanceof ParentElement)
		{
			((ParentElement) strategy).setParent(null);
		}
	}
}
 
开发者ID:LinuxSuRen,项目名称:phoenix.webui.framework,代码行数:59,代码来源:SeleniumCheck.java


示例17: getPlotPoint

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
private PlotPoint getPlotPoint(int point) throws ElementNotVisibleException {
    if (point < 0) {
        throw new ElementNotVisibleException("Plot point ${point} not found");
    }
    return getPlotPoints().get(point);
}
 
开发者ID:gautamsabba,项目名称:UIFramework,代码行数:7,代码来源:LineChart.java


示例18: select

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
public void select() {
    if (isDisabled()) throw new ElementNotVisibleException("RadioElement is disabled and not selectable.");
    click();
}
 
开发者ID:lithiumtech,项目名称:mineraloil-selenium,代码行数:5,代码来源:RadioElement.java


示例19: whenClickOnNotVisibleElIGetError

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
@Test (expectedExceptions = ElementNotVisibleException.class)
public void whenClickOnNotVisibleElIGetError() {
    showHiddenButton.click();
    hiddenElNotVisible.click();
}
 
开发者ID:sdl,项目名称:Testy,代码行数:6,代码来源:FindElementIntegrationTest.java


示例20: fireEventAndWait

import org.openqa.selenium.ElementNotVisibleException; //导入依赖的package包/类
/**
 * fires the event.
 * 
 * @param event
 *            the event.
 * @return if fails.
 */
boolean fireEventAndWait(Eventable event) throws ElementNotVisibleException,
        InterruptedException;
 
开发者ID:aminmf,项目名称:crawljax,代码行数:10,代码来源:EmbeddedBrowser.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Jukebox类代码示例发布时间:2022-05-21
下一篇:
Java EmptyClosableIterator类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap