Phantomjs: Click done but the related action never happens on phantomjs. Works with chrome.

Created on 28 Jun 2016  路  3Comments  路  Source: ariya/phantomjs

Problem:

A Button is selected correctly with the CSS selector used, and then a click is performed on it. The event is marked as done as seen in the selenium logs, however if successful a new page must be rendered which does not happen.
The same piece of code works in chrome.

Environment:

WDIO version: v4.0.9
Node: 6.2.0
WDIO testrunner
Synchronous test.
selenium-server-standalone-2.53.0.jar
bhuvneshchaudhary@bhuviMac:ambari-selenium$ ./node_modules/phantomjs/bin/phantomjs --version
2.1.1

Details

      CommonElements.clickNext();
      browser.saveScreenshot('test1.jpg');
      browser.pause(5000);
      CommonElements.clickConfirmationOk();
      browser.pause(5000);
      // On Page 3
      browser.saveScreenshot('test.jpg');
      CommonElements.clickComplete();

In the above code snippet
clickNext() opens up a popup which has 2 buttons Cancel and Ok.
clickConfirmationOk() should click on the Ok button and move on to the next page
clickComplete() marks the completion on the new page.

However, clickConfirmationOk() is succesful as per the logs and it moves on to clickComplete(). However it keeps waiting for the element to exist, but it never comes up as actually its still on the pop which shows Ok and Cancel.

The CSS selector used to identify the button is correct, as verified by getHTML and other css selectors tools online.

Code Snippet

    clickConfirmationOk: {
        value: function () {
            var okSelector = '.modal-footer .btn.btn-success';
            browser.waitForExist(okSelector);
            console.log(browser.getHTML(okSelector));
            browser.waitForEnabled(okSelector, 100000);
            browser.click(okSelector);
        }
    },
    clickComplete: {
        value: function () {
            var completeSelector = '#common-progress-page .btn.btn-success.pull-right';
            browser.waitForExist(completeSelector);
            console.log(browser.isEnabled(completeSelector));
            browser.waitForEnabled(completeSelector, 900000);
            browser.click(completeSelector);
        }
    }

Logs

Selenium Logs https://gist.github.com/bhuvnesh2703/aec82bea06debf92f9a4f6e4da93c2ea:
Test Results Output: https://gist.github.com/bhuvnesh2703/076af36f5931c8fdae4a81db612bf4b7

stale

Most helpful comment

I'm also having a similar problem, but with bootstrap dropdown menus. I'm able to open the dropdown menu but if I try to click an element within the dropdown menu, the menu closes but no click handler is fired.

All 3 comments

@bhuvnesh2703 does this happen every time for you or only sometimes ? I'm seeing a similar problem where we use Capybara's find('#element').click and sometimes the tests fail. Using find().trigger('click') seems to work however.

I'm wondering whether this is the same problem or not and how to collect more information.

I'm also having a similar problem, but with bootstrap dropdown menus. I'm able to open the dropdown menu but if I try to click an element within the dropdown menu, the menu closes but no click handler is fired.

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olee picture olee  路  4Comments

simplegroupware picture simplegroupware  路  5Comments

dhilipsiva picture dhilipsiva  路  4Comments

mz3 picture mz3  路  5Comments

gustavohenke picture gustavohenke  路  4Comments