- Sellj
- Posts : 3
Join date : 2012-09-28
ElementNotVisibleException although element can be selected by the user
Sat Sep 29, 2012 7:08 pm
The following test fails with org.openqa.selenium.ElementNotVisibleException because one of the parent css elements contains a "hidden: none;". However, the element for the user is visable and can be selected. Hence, I would like to test it. Is there any way to work around that problem? It seems I cannot edit the css.
code of test
code of test
- Code:
FirefoxProfile profile = new FirefoxProfile(new File("/path/to/firefoxprofile"));
profile.setEnableNativeEvents(true);
driver = new FirefoxDriver(profile);
driver.manage().timeouts().implicitlyWait(16, TimeUnit.SECONDS);
driver.get("URL"); <== I couldn't enter the real URL since new members are not allowed to enter any Link within the first 7 days (the link is h t t p : / / w w w . a u t o s c o u t 2 4 . d e)
driver.findElement(By.linkText("Werkstattsuche")).click();
WebElement plzField = driver.findElement(By.id("cms-plz"));
plzField.sendKeys("81243");
driver.findElement(By.cssSelector("span.buttonBob span input[value='Werkstätten finden']")).click();
driver.findElement(By.linkText("Inspektion (mit Preis)")).click();
Select selectMarke = new Select(driver.findElement(By.cssSelector("select.inputL[name='MakeId']")));
selectMarke.selectByVisibleText("BMW");
- SouravActive particpant
- Posts : 17
Join date : 2012-06-28
Re: ElementNotVisibleException although element can be selected by the user
Mon Oct 08, 2012 5:51 pm
Hi,
If this particular item's 'hidden' attribute is changed by some functions, you can 'sleep' for few millisecs after opening the page.
If this particular item's 'hidden' attribute is changed by some functions, you can 'sleep' for few millisecs after opening the page.
- ashish_techieAmateur
- Posts : 73
Join date : 2011-08-09
Re: ElementNotVisibleException although element can be selected by the user
Wed Oct 31, 2012 12:54 am
you can use this logic
while(element.isDisplayed()){
Thread.sleep(1000)
}
This will wait till emenet is visible
Regards
Ashish
For selenium tutorials:
www.qtpselenium.com/selenium-tutorials
while(element.isDisplayed()){
Thread.sleep(1000)
}
This will wait till emenet is visible
Regards
Ashish
For selenium tutorials:
www.qtpselenium.com/selenium-tutorials
Permissions in this forum:
You cannot reply to topics in this forum