简体   繁体   中英

Selenium Webdriver error “Element is not clickable at point” PrimeFaces SelectOneMenu

I've already checked many questions about this error, but none of the solutions I found there was working for me. My tests on SelectOneMenu elements works fine with FF and IE, but not with Chrome.

driver.findElement(By.id("csbform:bankszamlaSelectOne_label")).click();

I have no clue how to fix the problem, however I know what is it. The prime faces dropdown list component(selectonemenu) makes an ajax call when I choose an option of the list, which changes another dropdown's options(this is the one with id="csbform:bankszamlaSelectOne_label") that I should wait for completion. I use the following function to wait for the ajax to be complete: the function can be found here And that function is working like charm with FF and IE.

My main problem that I can't find a suitable solution for Chrome. I don't want to use any thread.Sleep() function in my test, because it's not a solution to wait for an unknown amount of time. It would be 1-2 seconds but would be much more due to the load of the server the webapplication is running on. So it's unpredictable.

I tried the javascript executor to scroll up or down, but it didn't work, i also tried expectedconditions to wait until the element to be clickable, but nothing.

Please help me, cause I don't have any other idea to fix this.

The html code where the problem occurs:

<h:panelGroup layout="block" styleClass="input-row input-select">
                                        <h:outputLabel styleClass="label" value="#{msgs.Partner}"/>
                                        <h:panelGroup layout="block" styleClass="input-container">
                                            <p:selectOneMenu effectSpeed="120"  id="partnerSelectOne" value="#{csopBeszFelvitelManagedBean.selectedPartner}" styleClass="fullwidth">
                                                <f:selectItems value="#{csopBeszFelvitelManagedBean.partnerListaSelectItems}"/>
                                                <f:converter converterId="EntityConverter"/>
                                                <p:ajax update="bankszamlaSelectOne, csodeljaras"/>
                                            </p:selectOneMenu>
                                            <p:message for="partnerSelectOne" />
                                        </h:panelGroup>
                                    </h:panelGroup>

                                    <h:panelGroup layout="block" styleClass="input-row input-select">
                                        <h:outputLabel styleClass="label" value="#{msgs.Szamla}"/>
                                        <h:panelGroup layout="block" styleClass="input-container">
                                            <p:selectOneMenu effectSpeed="120"  id="bankszamlaSelectOne" value="#{csopBeszFelvitelManagedBean.selectedBankszamla}" styleClass="fullwidth">
                                                <f:selectItems value="#{csopBeszFelvitelManagedBean.bankszamlaListaSelectItems}"/>
                                                <f:converter converterId="EntityConverter" />
                                                <p:ajax update="partnerSelectOne" />
                                            </p:selectOneMenu>
                                            <p:message for="bankszamlaSelectOne" />
                                        </h:panelGroup>
                                    </h:panelGroup>

The problem was already solved. There was a primefaces block-ui element that blocks the screen for some millisec. It was fast enough to be invisible for the user and not enough fast to dissapear, however the ajax queue had already emptied, but my test fails on it. I gave a unique id for that blocker element and now i'm using expectedconditions.invisibilityof() function to be sure there's no block-ui element on the screen when i'm trying to click on the second selectonemenu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM