开发者

Selenium (WebDriver) cannot see richfaces modal panel

I'm having some issues trying to test elements inside a RichFaces modal panel, as the one in the demo page of RichFaces here

the issue is that once retrieved an element I cannot interact with it because WebDriver throws a ElementNotVisibleException.

I check it with firebug, and it appears greyed out, because some of the divs have height and width set to 0.

I tried to set all the divs manually with a height and size to see if it changes but there is no way to make it work, so I suppose there must be something else affecting the visibility of the modal panel, but can开发者_运维百科not find what.

Has anyone tested webdriver or selenium against a richfaces panel?

Thanks in advance.

Edit: For the code, is too much to put here, but basically I adapted the jbehave tutorial for the etsy website (the one using spring to inject dependencies), that can be found here.

The architecture is using a PropertyWebDriverProvider that is configured by maven properties to use InternetExplorer or Firefox and is using PageObject pattern (all the pages extend from WebDriverPage).

For specific code, the one from JimEvans gives me the same error.


The following code seems to work for me using the demo site you linked to in your question. It gets the text content of the modal panel, then clicks the "button" to close the panel.

public void testPanel() {
  WebDriver driver = new InternetExplorerDriver();
  driver.get("http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf?c=modalPanel");
  WebElement panelShow = driver.findElement(By.id("j_id352:link"));
  panelShow.click();
  WebElement panel = driver.findElement(By.id("j_id352:panelCDiv"));
  WebElement panelTextElement = panel.findElement(By.className("rich-mpnl-body"));
  System.out.println(panelTextElement.getText());
  WebElement panelCloseButton = panel.findElement(By.id("j_id352:hidelink"));
  panelCloseButton.click();
}


Only solution I found out was to do all the interaction with javascript through webdriver

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜