org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with

前端 未结 7 1748
终归单人心
终归单人心 2020-12-30 13:33

I am trying to execute below Selenium Web driver script, But I am getting org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may n

7条回答
  •  粉色の甜心
    2020-12-30 14:07

    Finally this worked for me. Element is not currently visible and so may not be interacted with.

    Initially it was like test was successful only 2 of 5 times. Was not sure how it was working sometimes and others not.

    Worked by reducing the security settings in IE. Enable all activeX controls. Enable scripts and IFRAMES also. Some of these will warn to put computer at risk, but it was the only solution I had. Introduce Explicit wait by using presenceOfElementLocated instead of visibilityOfElementLocated at every point where page load takes time.

        WebDriverWait wait = new WebDriverWait(driver,30);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='campaignListTable']")));   /*examining the xpath for a search     
        box*/
        driver.findElement(By.xpath("//*[@id='campaignListTable']")).sendKeys("TEXT");   /*enter text in search 
        box*/
    

提交回复
热议问题