admin管理员组文章数量:1292955
I am automating an web application and I need to type in a value in an input text box.
My plan is to develop an friendly function, where in if I pass the label associated with the text , I should be able to enter the value. In this scenario, I am not dependant on xpaths or anything else, only the label. I figured out the selector. It is
selector = `::-p-aria(${textboxLabel}) ::-p-aria([role="textbox"])`;
but the issue is the text box label. We dont know the exact label text but only a partial label text. What I mean by here is , it can be like any of the below
Is it possible to get a selector which satisfies a partial label text, in this case, "First"
Its an augular application and WCAG2.0 compatible. But -p-aria only supports exact label text
Tried,
selector = `::-p-text(${textboxLabel})`;
but it is pointing to the label element and not to the input element.
Any help is appreciated. I am after a selector which gets the partial text as input and any other input ( which is generic ) to identify the text box, I mean point to the input tag. Thank you
I am automating an web application and I need to type in a value in an input text box.
My plan is to develop an friendly function, where in if I pass the label associated with the text , I should be able to enter the value. In this scenario, I am not dependant on xpaths or anything else, only the label. I figured out the selector. It is
selector = `::-p-aria(${textboxLabel}) ::-p-aria([role="textbox"])`;
but the issue is the text box label. We dont know the exact label text but only a partial label text. What I mean by here is , it can be like any of the below
Is it possible to get a selector which satisfies a partial label text, in this case, "First"
Its an augular application and WCAG2.0 compatible. But -p-aria only supports exact label text
Tried,
selector = `::-p-text(${textboxLabel})`;
but it is pointing to the label element and not to the input element.
Any help is appreciated. I am after a selector which gets the partial text as input and any other input ( which is generic ) to identify the text box, I mean point to the input tag. Thank you
Share Improve this question asked Feb 13 at 4:51 Timothy RajanTimothy Rajan 1,9579 gold badges44 silver badges65 bronze badges 3 |1 Answer
Reset to default 0Thanks everyone for responding to my question. Unfortunately, Puppeteer does not have a direct answer to this scenario. The only way to achieve the outcome is to filter out all text boxes and then apply another filter to find the right text box. Not an direct fix but an hack based on the label element.
I mean, formulate an XPath to find an label element which has "First" and then from that collection, apply an index.
Happy to help if you need more information
STEP 1 : Find all text boxes. =>collection1[]
STEP 2 : Find those text boxes who has First as an associated Label=>collection2[]
STEP 3 : Fetch as per the index, Say collection2[0]
本文标签: cssPuppeteerUnable to select an input box based on paria and ptextStack Overflow
版权声明:本文标题:css - Puppeteer - Unable to select an input box based on -p-aria and -p-text - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741564020a2385614.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
~ input
. Maybe I misunderstood that – pguardiario Commented Feb 14 at 3:29::-p-text(First)
uses a substring, and if you click the label it should focus the input. Can you share some sample HTML? – ggorlen Commented Feb 14 at 6:17