Is it possible to get string locator from already defined Selector in Testcafe?

Viewed 100

I'm very curios about this, and I would be really happy if there is a way to extract only string value from already defined Selector in Testcafe.

Example:

const element = Selector('[test-id="some-locator"]');

Now I need something like element.getLocator() which can return back '[test-id="some-locator"]' value to me. I have custom method for some navigations, asserts and such, and I would like to enrich my error messages with locators and such.

In protractor there is a method ".locator()" which does exactly what I explained.

Any help would be appreciated, thx!

0 Answers
Related