1
votes

I have the following problem:

I have to check via Selenium if an input field has been filled with a expected manually inserted text.

Here's the input field with the value of '50':

<input type="text" class="value_per form-control input-sm valid" name="per_slider1" idslider="1" value="50">

I won't look for the @value, but instead, the value that I can edit in the form. For clarification, the input's @value will be always '50' even if I edit the input text to '100' and I don't know how to get the '100' via Xpath.

I already tried with:

//input[@name='per_slider']/text()

or

//input[@name='per_slider']/@value

but they don't work.

If you have a fast solution for this, all comments are appreciated.

I'm using PHPunit to test a website via Selenium(This info should be useless).

2

2 Answers

0
votes

If you want that value which have 100 only then use something like below:-

//input[@name='per_slider1' and @value='100']

The xpath you are trying

//input[@name='per_slider']/@value

You should use. You have missed 1 after per_slider

//input[@name='per_slider1']/@value

Hope it will help you :)

0
votes

Try

element.getAttribute("value") 

It should work! Usually only the displayed "value" attribute in the browser-tools do not get updated, but actually it gets updated and you can pull it ;-)

*Assuming that you enter your new value and press enter or tab to another element or sth.