I'm trying to create a selector using the withText
filter and wanting to select the sibling element.
given: const Create_asset = S('span').withText('Create Asset')
Create_asset()
returns a ReExecutablePromise
with the nextSibling()
method.
await Create_asset()
returns a DOM-like(?) object, but without the nextSibling()
method, so it seems I can't do await Create_asset().withText('text').nextSibling()
How can I select a sibling subsequently when using the withText()
filter?
Thanks for any debugging tips too!
You can pass selectors to test actions to specify the action's target element. import { Selector } from 'testcafe'; fixture `My fixture` . page `http://devexpress.github.io/testcafe/example/`; const label = Selector('#tried-section'). child('label'); test('My Test', async t => { await t.
Yes, We can use Custom XPath in testcafe, Create a custom function, import it into your test file.
You can specify the assertion query timeout in test code with the options. timeout option. To set the timeout when you launch tests, pass the timeout value to the runner. run method if you use API or specify the assertion-timeout option if you run TestCafe from the command line.
The code below returns a DOM Node Snapshot.
const mySelector = Selector('span').withText('text');
const snapshot = await mySelector();
In your test scenario you can do something like this:
await t
.expect(mySelector.withText('some text').nextSibling().getAttribute('id')).eql('id1');
Note: TestCafe allows you to debug server-side test code and test behavior on the client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With