I'm using nightmare over my own site, for testing frontend.
The problem is about selector, my site is a bit dynamic and the selector logic of Nightmare seem intricate. I'll try to explain:
var test = yield nightmare
.goto('http://example.com')
.type('#input_1', text1)
.type('#input_2', text2)
.click(".submit")
.end()
.then(()=>console.log('done'));
This works well, but sometimes i need to select the input type more flexible, somethings like this:
var test = yield nightmare
.goto('http://example.com')
.type('div:contains("label1") > input').val('text1'), text1)
.type('div:contains("label2") > input').val('text2'), text2)
.click(".submit")
.end()
.then(()=>console.log('done'));
With this i receive this error:
Error: Failed to execute 'querySelector' on 'Document':
'div:contains("Sinistro") > input' is not a valid selector.
question from:
https://stackoverflow.com/questions/65934861/nightmare-js-selector-logic 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…