-1

In my case all identifiers in a page is generated dynamically. So I can't use xpath.

I've found method in the documentation: grabAttributeFrom.

  • How I can see what's inside, when I using cmd in --debug mode?
  • Can I use grabAttributeFrom for extracting xpath's from a page when I searching inputs?
  • How I can get access to inputs which have name and they xpath generates dynamically and I can't use xpath's?

I tried this code:

I.fillField(locate('input').inside('.jq-panel-body-default').at(2),'John');

but it doesn't work correct and generate exception:

 FAIL  Field "{"type":"xpath","output":null,"strict":true,"locator":{"xpath":".//input[ancestor::*[contains(concat(' ', normalize-space(./@class), ' '), ' jq-panel-body-default ')]][position()=2]"},"value":".//input[ancestor::*[contains(concat(' ', normalize-space(./@class), ' '), ' jq-panel-body-default ')]][position()=2]"}" was not found by text|CSS|XPath
Md. Abu Taher
  • 17,395
  • 5
  • 49
  • 73

1 Answers1

1
  1. How I can see what's inside, when I using cmd in --debug mode?

Inside.. what? If you want to log value of attribute, grab it and log:

Scenario("test", async (I) => {
  ...
  const attributeValue = await I.grabAttributeFrom(<locator>, <attribute>);
  console.log(attributeValue);
  ...
});
  1. Can I use grabAttributeFrom for extracting xpath's from a page when I searching inputs?

grabAttributeFrom is for grabbing of attributes value, not for xpath finding. But if you ask, can you use xpath in locator argument, yes you can.

  1. How I can get access to inputs which have name and they xpath generates dynamically and I can't use xpath's?

This is not enough to ask you. Share some DOM part or something to understand. If you mean name attribute, you can use filtering by name: //input[@name="<your element name>"]