Open VijayanRamachandran opened 2 years ago
you may misunderstand element id
and dom id, and to get the text content from a DOM-element, please refer to getText
To clarify @xupea comment, I have put a code sample below.
Use await (await app.client.$("#test")).getText()
where app
refers to the Spectron Application
and #test
refers to the element in the DOM with id test (<h1 id="test">Hello World</h1>
).
Hi,
Currently i am facing an issue with Spectron in combination with Mocha.
When i try to get element text using spectron in test case i am facing error "no such element".
Sample.html
main.js
package.json
"devDependencies": { "electron": "^13.1.6", "mocha": "^9.0.2", "spectron": "^15.0.0" }
SampleTest.js
Error
Can you help me regarding this ?
Is it problem in my implementation ?