Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added <no such element> to array of DO_NOT_LOG_ERRORS #141

Merged
merged 1 commit into from
Apr 24, 2014

Conversation

kbingman
Copy link

This just adds 'no such element' to the DO_NOT_LOG_ERRORS list. This one has been causing us lots of grief with the elementPresent and waitForElementPresent commands.

Thanks!

Keith

@davidlinse
Copy link
Contributor

Would you mind explaining this a bit more in detail ?

regards
~david

@kbingman
Copy link
Author

We have been getting consistent errors from the Selenium driver whenever an element is not found. We are exclusively testing JS driven, dynamic sites, so the element is often not found. Then Nightwatch polls and the element is there. In this case, the error shows up on the command line, polluting the Nightwatch results. I simply added the error that is bugging us to the ignore list, which right now only has 'Unable to locate element'.

Does that help?

@davidlinse
Copy link
Contributor

Yes, it did but i would like to slightly disagree. What about beeing more "defensive" when writing the tests ? Since all this sfuff is async you actually have to waitFor... some things to be present or happen in the page..

I'm not fighting against the "do-not-log" request just asking..

regards
~david

@kbingman
Copy link
Author

Basically, we have the choice of writing a pause or waiting for an element. A pause is very brittle, so waiting for an element is by far the better choice. I guess my main concern is that Selenium is reporting an error, where from the perspective of Nightwatch, there is none.

As for defensive tests, trust me we are doing that. But there are things that plain and simply have to be waited on, and Nightwatch should not be throwing errors on valid commands.

@scalvert
Copy link
Contributor

@davidlinse the issue is actually pretty simple. This isn't a question about the structure of the tests themselves, and whether or not they should be more defensively written. This happens when you are using the waitFor... commands in tests. Because the command polls while waiting for the presence of an element, it's outputting when the element is not found during the command's execution. It should only output a not found error if the element is truly not found, not when it's not finding the element while polling for it.

Does this make more sense?

@davidlinse
Copy link
Contributor

it's outputting when the element is not found during the command's execution.
Does this make more sense?

yes, sir !

@scalvert
Copy link
Contributor

Cheers!

@beatfactor
Copy link
Member

As far as I can see the 'no such element' string never appears in the error message itself, it appears only in the state property of the response object and the DO_NOT_LOG_ERRORS check is performed only on the message property.

Considering the error response below the error message should not be shown so I'm curious in what circumstances you are getting the 'no such element' string inside the message property.

{
  status: 7,
  sessionId: 'example-123456',
  value: { 
    message: 'Unable to locate element: {"method":"css selector", "selector":"some-element"}',
    state: 'no such element'
  }
}

Are you referring to the case when the test is ran with --verbose mode enabled? Which version of selenium are you using and on which browser?

@kbingman
Copy link
Author

We are using v2.39.0 of Selenium with Chrome and Chromedriver v2.8.x

The --verbose flag is turned off, but we get the selenium error in any case, whenever waitForElmentPresent is used.

Here is the full error:

There was an error while executing the Selenium command - enabling the --verbose option might offer more details.
no such element
      (Session info: chrome=34.0.1847.116)
      (Driver info: chromedriver=2.8.241036,platform=Mac OS X 10.9.2 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 6 milliseconds
    For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
    Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
    System info: host: 'Uned.local', ip: '169.254.32.34', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.2', java.version: '1.6.0_65'
    Session ID: 8707c9635e52f8b06ad3b38a80ca59fc
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/var/folders/hx/b4qs6xqn4qb9tcbvh342htt80000gn/T/.org.chromium.Chromium.SY5tdy}, rotatable=false, locationContextEnabled=true, version=34.0.1847.116, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]

This entire message appears in the value.message attribute of the response. Looks like it is from Chromedriver to me.

Thanks

@davidlinse
Copy link
Contributor

FYI.. there is a selenium 2.4x out already
On Apr 23, 2014 7:53 PM, "Keith Bingman" [email protected] wrote:

We are using v2.39.0 of Selenium with Chrome and Chromedriver v2.8.x

The --verbose flag is turned off, but we get the selenium error in any
case, whenever waitForElmentPresent is used.

Here is the full error:

There was an error while executing the Selenium command - enabling the --verbose option might offer more details.
no such element
(Session info: chrome=34.0.1847.116)
(Driver info: chromedriver=2.8.241036,platform=Mac OS X 10.9.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 6 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'Uned.local', ip: '169.254.32.34', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.2', java.version: '1.6.0_65'
Session ID: 8707c9635e52f8b06ad3b38a80ca59fc
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/var/folders/hx/b4qs6xqn4qb9tcbvh342htt80000gn/T/.org.chromium.Chromium.SY5tdy}, rotatable=false, locationContextEnabled=true, version=34.0.1847.116, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]

This entire message appears in the value.message attribute of the
response. Looks like it is from Chromedriver to me.

Thanks


Reply to this email directly or view it on GitHubhttps://github.com/beatfactor/nightwatch/pull/141#issuecomment-41193120
.

@kbingman
Copy link
Author

True, but I get the same error. Like i said, I am pretty sure it is the Chromedriver and this would be a very simple fix.

@scalvert
Copy link
Contributor

👍

@dylanfoster
Copy link

Same issue I am having. Only happens when using waitForElementPresent. While it's polling it fails, giving the error, and then eventually passing. This also pollutes Jenkins results with a false fail.

@beatfactor
Copy link
Member

Alright then, the error message is different for chrome driver. So much for consistency. I think in this case checking the state property would have worked better but for now let's just get this out of the way.

beatfactor added a commit that referenced this pull request Apr 24, 2014
added <no such element> to array of DO_NOT_LOG_ERRORS
@beatfactor beatfactor merged commit 06b3547 into nightwatchjs:master Apr 24, 2014
@scalvert
Copy link
Contributor

Is a new version going to be published on NPM soon?

@beatfactor
Copy link
Member

yes, shortly.

@scalvert
Copy link
Contributor

Great. Thanks, Andrei!

@beatfactor
Copy link
Member

no problem, it's in npm now.

@scalvert
Copy link
Contributor

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants