Clicking issue with selenium 44 and newest Nightwatch

1,491 views
Skip to first unread message

Michael Valentine

unread,
Dec 11, 2014, 6:39:14 PM12/11/14
to nightw...@googlegroups.com
For some reason the test I had working a couple days ago no longer works. Ive kept up to date with nightwatch revisions and upgraded to Firefox 33 and Selenium 2.44.0.

The issue is that I am selecting elements and clicking them using this format:
client.element('partial link text', 'Cancel', function(element){
            if(element.error){
            }
            else{
                client.elementIdClick(element.value.ELEMENT);
            }
        });

Which works fine for the first 4 clicks in the test, but then I get down to two clicks that seem to register in Selenium, because it throws no errors, does not tell me the elements dont exist or anything, and keeps moving on with the test. The problem is, the clicks didnt actually happen. The selenium server dumps after a while saying it cant find the new element its looking for but thats because the element wont exist unless the two previous clicks occur.

Here is the code in question, and I have verified all the selectors are correct manually, and they havent changed from when the test last worked.

client.element('css selector', 'input[id='+input["region"]+']', function(element){
            if(element.error){
                console.error(element.error)
            }
            else {
                //This click and the next dont register
                client.elementIdClick(element.value.ELEMENT, function () {
                    client.element('css selector', 'button[type=submit]', function (element) {
                        if (element.error) {
                            console.log(element.error)
                        }
                        else {
                            client.elementIdClick(element.value.ELEMENT);
                        }
                    });
                    var startTime = new Date().getTime();
                    client.useCss();

                    //Wait for the DOM complete button or timeout
                    client.waitForElementPresent("button[name=connect]", 3600000, function(){
                        //This is where the bug happens, it never finds the button
                    })
                });
            }
        });

Michael Valentine

unread,
Dec 11, 2014, 6:41:38 PM12/11/14
to nightw...@googlegroups.com
At this point I'm unsure if it is nightwatch, selenium, or firefox, here is the selenium output:


Executing: [find element: By.selector: input[id=us-east-1]])\n22:32:17.531 INFO - Done: [find element: By.selector: input[id=us-east-1]]\n22:32:17.534 INFO - Executing: [click: 5 [[FirefoxDriver: firefox on WINDOWS (cf14bd41-9b37-4564-9b92-e3673d535745)] -> css selector: input[id=us-east-1]]])\n22:32:17.664 INFO - Done: [click: 5 [[FirefoxDriver: firefox on WINDOWS (cf14bd41-9b37-4564-9b92-e3673d535745)] -> css selector: input[id=us-east-1]]]\n22:32:17.667 INFO - Executing: [find element: By.selector: button[type=submit]])\n22:32:17.674 INFO - Done: [find element: By.selector: button[type=submit]]\n22:32:17.676 INFO - Executing: [click: 6 [[FirefoxDriver: firefox on WINDOWS (cf14bd41-9b37-4564-9b92-e3673d535745)] -> css selector: button[type=submit]]])\n22:32:17.777 INFO - Done: [click: 6 [[FirefoxDriver: firefox on WINDOWS (cf14bd41-9b37-4564-9b92-e3673d535745)] -> css selector: button[type=submit]]]\n22:32:17.780 INFO - Executing: [find element: By.selector: button[name=connect]])\n22:32:21.201 WARN - Exception thrown\norg.openqa.selenium.NoSuchElementException: Unable to locate element: {\"method\":\"css selector\",\"selector\":\"button[name=connect]\"}\nCommand duration or timeout: 3.10 seconds\nFor documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html\nBuild info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'

Michael Valentine

unread,
Dec 11, 2014, 6:52:34 PM12/11/14
to nightw...@googlegroups.com
I can confirm that watching it happen, neither of the clicks actually registered, I watched the test run and once it got to that part, nothing on the page ever changed.

Lacy Morrow

unread,
Dec 12, 2014, 8:11:53 PM12/12/14
to nightw...@googlegroups.com
Something to check is that no other elements are covering the target click elements. Selenium cannot tell if an element (a fixed header for ex) is blocking the target, so the element "above" it would receive the click. Selenium scrolls the page so that the target is at the very top of the page (or bottom depending on your settings) before taking actions.

Michael Valentine

unread,
Dec 15, 2014, 12:29:50 PM12/15/14
to nightw...@googlegroups.com
I do not think this is the case. There are no elements above it, and nothing about the page in question has changed over the last month.

Jiten Oswal

unread,
May 19, 2015, 7:22:50 PM5/19/15
to nightw...@googlegroups.com
Were you able to solve this problem ? Even i got stuck at this issue.

Rachna

unread,
Aug 5, 2015, 9:35:37 PM8/5/15
to NightwatchJs
Were you able to solve this issue? I am currently facing the same issue where the click gets executed by nightwatch, but doesn't really perform the click on the UI as a result of which the subsequent steps fail.

Stephanie Madison

unread,
Aug 6, 2015, 10:28:49 AM8/6/15
to NightwatchJs
If you haven't already, try running with --verbose to ensure the click request is being fired. Also what version of selenium and is the issue only happening in specific browsers?
Reply all
Reply to author
Forward
0 new messages