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


Java ElementNotVisibleException类代码示例

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


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


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