Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

ElementNotVisibleException although element can be selected by the user

View previous topic View next topic Go down

ElementNotVisibleException although element can be selected by the user

Post by Sellj on 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:
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");

Sellj

Posts : 3
Join date : 2012-09-28

Back to top Go down

Re: ElementNotVisibleException although element can be selected by the user

Post by Sourav on 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.

Sourav
Active particpant
Active particpant

Posts : 17
Join date : 2012-06-28

Back to top Go down

Re: ElementNotVisibleException although element can be selected by the user

Post by ashish_techie on 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

ashish_techie
Amateur
Amateur

Posts : 73
Join date : 2011-08-09

Back to top Go down

Re: ElementNotVisibleException although element can be selected by the user

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum