1

I am writing some automated tests using Fluentlenium and PhantomJS. I am having trouble accessing the id "#title". The test I have written is as follows:

    @Test
    public void testCreateButton() {
        startAppWithCallback(new F.Callback<TestBrowser>() {
            public void invoke(TestBrowser browser) throws InterruptedException {
                CalendarPage calendarPage = browser.createPage(CalendarPage.class);
                calendarPage.withDefaultUrl(BASE_URL);
                calendarPage.go();
                calendarPage.selectCreateButton();
                calendarPage.typeTitle("Java Fundamentals");
                browser.await().atMost(3, TimeUnit.SECONDS);
            }
        });
    }

The test is running, and seems to be able to select the Create button, which should then open up a modal window, but for some reason it is having trouble seeing the id on this modal. The error message that I get is as follows:

 org.openqa.selenium.NoSuchElementException: No element is displayed or enabled. Can't set a new value.

Is there something I am not doing when it comes to accessing the id on the modal window? Any help at all would be much appreciated.

  • Could you provide the implementation of CalendarPage? And the HTML of your page? Is your modal window in an iframe? – segalaj May 19 '15 at 08:38

1 Answers1

0

Usually modal windows take some time to attach to the DOM of the page you are accessing. Though you have added 3 seconds to wait for the element to appear/ attach to the DOM but the time is not sufficient. I would not recommend to increase the timeout but would recommend to wait until for the element to appear and then move forward. for e.g. you could do following thing to wait for an element to appear on the page instead of waiting statically:

FluentWaitMatcher matcher = page.await().atMost(, TimeUnit.SECONDS).until(findPattern);