I don't understand, why my text is not found after an ajax request.
In the first tab, directly after clicking the button, it is found. But not found in the other tab. In the browser I can see the element with my eyes. It is rendered...
Code: Select all
@Test
public void testAjax(@Drone FirefoxDriver browser) {
browser.get("http://141.28.53.6:8080/SeleniumAjax/");
//click on ajax button
browser.findElement(By.id("form:tab:button")).click();
new WebDriverWait(browser, 5).until(ExpectedConditions.visibilityOfElementLocated(By.className("normalOutput")));
new WebDriverWait(browser, 5).until(ExpectedConditions.visibilityOfElementLocated(By.className("showAfterAjaxClick")));
//switch the tab
browser.findElement(By.partialLinkText("Godfather Part II")).click();
//here is the crash
new WebDriverWait(browser, 5).until(ExpectedConditions.visibilityOfElementLocated(By.className("showAfterAjaxClick")));
}
Code: Select all
org.openqa.selenium.TimeoutException: Timed out after 5 seconds waiting for visibility of element located by By.className: showAfterAjaxClick
I'm using:
- Windows 7
- Firefox 30
- Selenium 2.43.1
- Arquillian Drone 1.3.1.Final
The tabView is rendered with primefaces 5.0.
In this forum I found "$.ajaxPrefilter(function( options ) { options.global = true;});" (http://forum.primefaces.org/viewtopic.p ... um#p110217) but does not work at my situation.
Here is my primefaces/jsf code:
Code: Select all
<p:outputPanel style="display:block;" id="id_srvc_content">
<h:form id="form">
<p:tabView id="tab" orientation="left">
<p:tab title="Godfather Part I">
<p:commandButton
id="button"
value="Ajax Request"
action="#{myController.doIt()}"
update=":id_srvc_content">
</p:commandButton>
<h:outputText
styleClass="normalOutput"
value="normal output"/>
<br/>
<h:outputText
styleClass="showAfterAjaxClick"
value="This here can be found after AJAX call" rendered="#{myController.showTextAfterAjax}" />
</p:tab>
<p:tab title="Godfather Part II">
<h:outputText
styleClass="showAfterAjaxClick"
value="This here can not be found after AJAX call" rendered="#{myController.showTextAfterAjax}" />
</p:tab>
</p:tabView>
</h:form>
</p:outputPanel>
Code: Select all
@Named
@ViewScoped
public class MyController {
boolean showTextAfterAjax = false;
public void doIt() {
showTextAfterAjax = true;
}
public boolean isShowTextAfterAjax() {
return showTextAfterAjax;
}
public void setShowTextAfterAjax(boolean bla) {
this.showTextAfterAjax = bla;
}
}