How to choose text input by entering text in xpath?

Work on creating automated tests with selenium I problem when I try to find text in the text inside it. I use the Xpath plugin and FirePath to check its result.

My xpath:

//input[@context='@name' and contains(@class, 'edit-string') and contains(@value, 'testSection')]

and returns nothing, and when I delete the last condition:

//input[@context='@name' and contains(@class, 'edit-string')]

I found the required div.

As I found out, the problem is that the value attribute does not contain typed text. The Firebug console proves this theory (the jQuery library is present on the page):

>>>> $("input.edit-string")[0].getAttribute("value")
null
>>>> $("input.edit-string")[0].value
"testSection"
>>>> $("input.edit-string")[0].getAttribute("context")
"@name"

Any ideas how I can use typed text in an xpath expression?

+3
source share
2 answers

Try the following instructions.

--- > --- >
focus --- > class= edit-string
typeKeys --- > class= edit-string --- >

0

: XPath   //input [@context = '@name' (@class, 'edit-string')]

1:

, Input , "edit-string". XPath CSS

css=.edit-string

2:

$(".edit-string").getText();
0

All Articles