具有相同formControlname的多个元素的量角定位器

发布于 2025-01-25 18:56:02 字数 216 浏览 5 评论 0原文

我正在尝试找到一个文本字段的元素,并提供formControlname。但是,对于单击“添加”按钮后的所有输入字段,formControlname都是相同的。那么,如何使用相同的FormControlname插入到第n个文本字段中?如何使用相同的FormControlname获取元素的总数?

我是使用量角器的自动化的新手,请提供帮助。

我们目前正在使用量角javaScript的黄瓜框架。

I am trying to locate an element which is text field, and provided with formControlName. But the formControlName is same for all the input fields that comes after clicking on the add button. So how can i insert into the nth text field with same formControlName? how to fetch the total count of elements with same formControlName?

I am new to this automation using protractor, please do help.

We are currently using cucumber framework with protractor javascript.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝眼睛不忧郁 2025-02-01 18:56:02

为了获取具有相同formControlname元素的总计数,可以通过使用

var count = await element.all(by.xpath("ElementXpath")).count();

输入到nth元素来实现,可以通过与定位器一起提供数字来完成,例如,

//input[name='subject'][3]

它将在此处选择带有名称主题的第3个输入到底订单

To fetch the total count of elements with same formcontrolname can be achieved by using

var count = await element.all(by.xpath("ElementXpath")).count();

If you want to input to nth element it can be done by providing the number with the locator for example,

//input[name='subject'][3]

here,it will select the 3rd input with name subject from top to bottom order

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文