简体   繁体   English

org.openqa.selenium.ElementNotVisibleException:元素当前不可见,因此可能无法与Command持续时间或超时进行交互:

[英]org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout:

My problem is that selenium give the exception so visible elements. 我的问题是硒赋予了异常可见元素。 I don't understand this because when I put to build in my machine works! 我不明白这一点,因为当我在机器中进行构建时,它就可以工作了! ( The tests build at bamboo). (测试建立在竹子上)。

This is a exception: 这是一个例外:

 org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout: 30.06 seconds Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40' System info: host: 'N/A', ip: 'N/A', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-52-virtual', java.version: '1.7.0_72' Session ID: 1757208d-d49e-4792-b053-e55e7300c233 Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=34.0}] org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout: 30.06 seconds 

Code: 码:

String name;
String key;

@Before
public void setUp() throws InterruptedException {

    driver.findElement(By.id("menu_topMenu.maintenance")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("menu_topMenu.route")).click();
}

@Test
public void test() throws InterruptedException {

    AddRoute addRoute = new AddRoute(driver);
    addRoute.add();
    name = addRoute.getName();
    key = addRoute.getKey();
    Thread.sleep(3000);
    driver.findElement(By.cssSelector
            ("#Route_btn_novo")).click();
    driver.findElement(By.cssSelector
            ("#Route_key > input[type=\"text\"]")).sendKeys(key);
    driver.findElement(By.cssSelector
            ("#Route_description > input[type=\"text\"]")).clear();
    driver.findElement(By.cssSelector
            ("#Route_description > input[type=\"text\"]")).sendKeys(name);
    driver.findElement(By.cssSelector
            ("#Route_organization > div.lookUpHitArea")).click();
    driver.findElement(By.cssSelector
            ("#MonetUIFieldsLookupGridContainer_organization > div.slick-pane.slick-pane-top.slick-pane-left > div.slick-viewport.slick-viewport-top.slick-viewport-left > div > div:nth-child(2) > div.slick-cell.l0.r0.cell-row")).click();
    driver.findElement(By.cssSelector
            ("#Route_plannedCost > input")).sendKeys("10000");
    driver.findElement(By.cssSelector
            ("#Route_origin > div.lookUpHitArea")).click();
    driver.findElement(By.cssSelector
            ("#MonetUIFieldsLookupGridContainer_location > div.slick-pane.slick-pane-top.slick-pane-left > div.slick-viewport.slick-viewport-top.slick-viewport-left > div > div:nth-child(1) > div.slick-cell.l1.r1.cell-row.selected")).click();
    driver.findElement(By.cssSelector
            ("#Route_lastStopIsDestination > input")).click();
    Thread.sleep(1000);
    driver.findElement(By.cssSelector
            ("#Route_btn_save_and_close")).click();
    Thread.sleep(3000);
    assertTrue("Rota existente nao validada corretamente",
            isDisplayedByCssSelector(driver, "#form_and_grid > div > div.monetInlineAlerContainer > div"));
}

} }

I don't know more what to do! 我不知道该怎么办!

I am not sure how your entire set up looks like. 我不确定您的整个设置如何。 But, a common practice is to use Selenium Grid in such case. 但是,通常的做法是在这种情况下使用Selenium Grid The idea is to have a selenium hub and multiple slaves(as many as you need and may be virtual machines) and have the CI server controlling the slaves to execute the tests. 这个想法是要有一个硒集线器和多个从属服务器(您可以根据需要设置多个虚拟机),并让CI服务器控制这些从属服务器以执行测试。 The issue you are having is because of CI server is not acting like your local machine is doing. 您遇到的问题是由于CI服务器无法像本地计算机那样运行。 The element is not visible means selenium is not able to interact with the browser which it should not on CI. 该元素不可见,这意味着硒无法与其不应在CI上的浏览器进行交互。 See this to explore more about the grid. 看到此内容以探索有关网格的更多信息。 This should help you to get started. 应该可以帮助您入门。

Note: This is one of many ways to execute selenium tests from CI 注意:这是从CI执行硒测试的多种方法之一

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.openqa.selenium.ElementNotVisibleException:元素当前不可见,因此可能无法与之交互 - org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with 线程“主” org.openqa.selenium.ElementNotVisibleException中的异常:元素当前不可见,因此可能无法与之交互 - Exception in thread “main” org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with org.openqa.selenium.ElementNotVisibleException: 元素当前不可见 - org.openqa.selenium.ElementNotVisibleException: Element is not currently visible org.openqa.selenium.ElementNotVisibleException:元素不可见 - org.openqa.selenium.ElementNotVisibleException: element not visible org.openqa.selenium.ElementNotVisibleException:通过SeleniumWebDriver和Java单击复选框时,元素当前不可见 - org.openqa.selenium.ElementNotVisibleException: Element is not currently visible while clicking a checkbox through SeleniumWebDriver and Java 异常org.openqa.selenium.ElementNotVisibleException:..element不可见 - Exception org.openqa.selenium.ElementNotVisibleException: ..element not visible org.openqa.selenium.ElementNotVisibleException:元素不可交互 - org.openqa.selenium.ElementNotVisibleException: element not interactable 元素当前不可见,因此可能无法与命令持续时间或超时交互:28毫秒 - Element is not currently visible and so may not be interacted with Command duration or timeout: 28 milliseconds org.openqa.selenium.ElementNotVisibleException - org.openqa.selenium.ElementNotVisibleException org.openqa.selenium.ElementNotVisibleException:尝试查找Google搜索结果时不可见的元素 - org.openqa.selenium.ElementNotVisibleException: element not visible while trying to locate google search result
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM