Closed ben-perrier closed 6 years ago
@ben-perrier - I used to have issues chaining asserts like your example. Does the call work if the assert and the click are like this?
module.exports = {
'demo test' : function (client) {
client.url('http://myapp.com')
.waitForElementPresent('#login_link', 10000) // 200 OK
.assert.elementPresent('#login_link'); // 200 OK
client.click('#login_link') // ERROR ?
.end
}
};
@Zechtitus thanks for replying, unfortunately the error remains the same:
INFO Request: POST /wd/hub/session/94978081-e31c-4143-adfe-a47192602450/element/undefined/click
- data:
- headers: {"Content-Length":0}
ERROR Response 500 POST /wd/hub/session/94978081-e31c-4143-adfe-a47192602450/element/undefined/click (73ms) { state: 'javascript error',
sessionId: null,
hCode: 1759792815,
@ben-perrier possible you could try this against google - just to verify the results are the same.
client.url('http://google.com')
.waitForElementPresent('#lst-ib', 10000) // 200 OK
.assert.elementPresent('#lst-ib') // 200 OK
.click('#lst-ib') // ERROR ?
.end();
oh and what version of firefox? I am using a selenium/node-firefox-debug:3.4 in a grid configuration... I know I was running into issues attempting to use the latest firefox build - 3.5.3 and had to fix the version to 3.4
UPDATE: I just tried the latest version of firefox and was running into the same issue in my logs - the 3.4 variant did not. a few of us have run into similar issues with the current latest selenium node-firefox-debug in this issue https://github.com/nightwatchjs/nightwatch/issues/1543
results I got with verbose turned on - seem to match up
smoketest/sometest INFO Request: POST http://hub:4444/wd/hub/session/fe87c80b-a36b-4955-9fd9-1b44a0a620d9/element
- data: {"using":"css selector","value":"#lst-ib"}
- headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":42}
smoketest/sometest INFO Response 200 POST http://hub:4444/wd/hub/session/fe87c80b-a36b-4955-9fd9-1b44a0a620d9/element (40ms) { state: 'success',
sessionId: null,
hCode: 1940123286,
value: { 'element-6066-11e4-a52e-4f735466cecf': '776288f6-2b70-44e8-a6c6-5b5966e3f0a9' },
class: 'org.openqa.selenium.remote.Response',
status: 0 }
smoketest/sometest INFO Request: POST http://hub:4444/wd/hub/session/fe87c80b-a36b-4955-9fd9-1b44a0a620d9/element/undefined/click
- data:
- headers: {"Content-Length":0}
smoketest/sometest ERROR Response 500 POST http://hub:4444/wd/hub/session/fe87c80b-a36b-4955-9fd9-1b44a0a620d9/element/undefined/click (26ms)
smoketest/sometest { state: 'javascript error',
sessionId: null,
hCode: 1647853641,
value:
{ additionalInformation: '\nDriver info: driver.version: unknown',
localizedMessage: 'Element reference not seen before: undefined\nBuild info: version: \'3.5.3\', revision: \'a88d25fe6b\', time: \'2017-08-29T12:54:15.039Z\'\nSystem info: host: \'8012ff4201b4\', ip: \'xxx.xxx.xxx.xxx\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.9.41-moby\', java.version: \'1.8.0_131\'\nDriver info: driver.version: unknown',
systemInformation: 'System info: host: \'8012ff4201b4\', ip: \'xxx.xxx.xxx.xxx\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.9.41-moby\', java.version: \'1.8.0_131\'',
supportUrl: null,
cause: null,
suppressed: [],
message: 'Element reference not seen before: undefined\nBuild info: version: \'3.5.3\', revision: \'a88d25fe6b\', time: \'2017-08-29T12:54:15.039Z\'\nSystem info: host: \'8012ff4201b4\', ip: \'172.18.0.3\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.9.41-moby\', java.version: \'1.8.0_131\'\nDriver info: driver.version: unknown',
hCode: 1991606150,
class: 'org.openqa.selenium.JavascriptException',
buildInformation: null },
class: 'org.openqa.selenium.remote.Response',
status: 17 }
Again, the first 2 requests are 200 and the 3rd one is a 500 with an empty data element.
INFO Request: POST /wd/hub/session/f155577a-3f61-6644-9a47-b0f2954c347c/element/undefined/click
- data:
- headers: {"Content-Length":0}
ERROR Response 500 POST /wd/hub/session/f155577a-3f61-6644-9a47-b0f2954c347c/element/undefined/click (195ms) { state: 'javascript error',
sessionId: null,
hCode: 585154452,
I started with the "Demo test google" sample code and this code never worked in my installation, when it comes accessing elements and interacting with them.
@ben-perrier I've been seeing the same issues with all of the 3.5 and now the 3.6 variants of node-debug
INFO Request: POST http://hub:4444/wd/hub/session/eeceea86-4fc1-499e-98f3-ca8fe2f25c8b/element/undefined/click
smoketest/test1 - data:
- headers: {"Content-Length":0}
smoketest/test1 ERROR Response 500 POST http://hub:4444/wd/hub/session/eeceea86-4fc1-499e-98f3-ca8fe2f25c8b/element/undefined/click (27ms)
smoketest/test1 { state: 'javascript error',
The only solution I have now is to use the older 3.4 version which does work. I will keep playing around and see if there is some short term soln.
@ben-perrier - ok I have a fix that works on my end with the latest firefox... basically it is to substitute click with the invoke
if you are using css:
client.execute(function click(sel) { document.querySelector(sel).click(); }, [selector]);
if xpath:
client.execute(function click(sel) { document.evaluate(sel, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click(); }, [selector]);}
I have a more elegant soln done in my own libraries - but maybe see if that works around the problem first. Aside from this - I think we have to wait until firefox drivers play nice with click (and other?) methods
@Zechtitus, i have same prob. It happens with latest gecko-driver
(selenium/standalone-firefox:3.5.0
or above).
Looks like nightwatch
wait entry ELEMENT
, but latest gecko
return element-6066-11e4-a52e-4f735466cecf
instead (specification https://w3c.github.io/webdriver/webdriver-spec.html#elements).
with version 3.4.0 all work fine
INFO Response 200 POST /wd/hub/session/cf0426b6-2d16-4142-a018-8748b1acb8fe/elements (176ms) { state: 'success',
sessionId: 'cf0426b6-2d16-4142-a018-8748b1acb8fe',
hCode: 438605693,
value: [ { ELEMENT: '0' } ],
class: 'org.openqa.selenium.remote.Response',
status: 0 }
INFO Request: GET /wd/hub/session/cf0426b6-2d16-4142-a018-8748b1acb8fe/element/0/displayed
- data:
- headers: {"Accept":"application/json"}
INFO Response 200 GET /wd/hub/session/cf0426b6-2d16-4142-a018-8748b1acb8fe/element/0/displayed (213ms) { state: 'success',
sessionId: 'cf0426b6-2d16-4142-a018-8748b1acb8fe',
hCode: 562104897,
value: true,
class: 'org.openqa.selenium.remote.Response',
status: 0 }
LOG → Completed command waitForElementVisible (395 ms)
LOG → Completed command useCss (1 ms)
https://travis-ci.org/instrumentisto/vue-app-example/builds/280784271
In versions 3.5.0 or above
INFO Response 200 POST /wd/hub/session/96ea1cdc-63d1-486e-bd30-68ace2968fa3/elements (150ms) { state: 'success',
sessionId: null,
hCode: 1090440510,
value:
[ { 'element-6066-11e4-a52e-4f735466cecf': '2a7b784d-1585-4f3c-b562-cc5f665c9228' } ],
class: 'org.openqa.selenium.remote.Response',
status: 0 }
INFO Request: GET /wd/hub/session/96ea1cdc-63d1-486e-bd30-68ace2968fa3/element/undefined/displayed
- data:
- headers: {"Accept":"application/json"}
ERROR Response 500 GET /wd/hub/session/96ea1cdc-63d1-486e-bd30-68ace2968fa3/element/undefined/displayed (152ms) { state: 'javascript error',
sessionId: null,
hCode: 1848680964,
value:
{ additionalInformation: '\nDriver info: driver.version: unknown',
localizedMessage: 'Element reference not seen before: undefined\nBuild info: version: \'3.5.0\', revision: \'8def36e068\', time: \'2017-08-10T23:00:22.093Z\'\nSystem info: host: \'2143c01b6db5\', ip: \'172.18.0.5\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.4.0-93-generic\', java.version: \'1.8.0_131\'\nDriver info: driver.version: unknown',
https://travis-ci.org/instrumentisto/vue-app-example/builds/280778475
I`m propose next solution: https://github.com/nightwatchjs/nightwatch/pull/1604
@yak80 - I just tried your branch and the problems went away with the latest node-firefox-debug (3.6 at this time). @ben-perrier - does this resolve your issues?
Thanks everyone, I switched selenium-standalone-server to version 3.4 and it appears to have fixed the problem. I can now click on elements and manipulate them too.
A fix for this issue is now in 0.9.17.
Happening for me again on nightwatch v0.9.19
This issue is not fixed.
Still seeing this issue on v0.9.21
Hey everyone, I have this issue where the gecko browser displays my page and can successfully wait for an element to be present and test for an element's presence. But it cannot read any element's property or click on it, or interact in any way with the element. See simple test below:
When clicking on the element (or trying to read any property like visibility for ex.), I can see that the request to selenium has 'element/undefined' in it, and the data object is empty whereas it should pass the selector. I have tried with many different selectors and selector strategy, but nothing does it. See extract of verbose log below:
And here is my configuration in nightwatch.json :