A
A
Andrey Puzov2020-09-15 22:44:00
selenium
Andrey Puzov, 2020-09-15 22:44:00

How to get to nested input field in Selenium?

I can’t get to the input in selenium for a couple of days:

<_div class="a"_>
    <_div class="form-group b"_>
        <_label_>"Ya tut"<_/label_>
        <_input class="form-control cccc"_>
    <_/div_>
<_/div_>

how to get to the class ssss through the whole chain (because there are also classes a and b and form-groups)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daria Motorina, 2020-09-16
@glaphire

//div/div/input[contains(@class, 'cccc')]
But in general, you can immediately search by the input container class, or add a container class to each div, if you need to specify the entire nesting chain directly

A
Andrey Puzov, 2020-09-16
@puzzlo

Thank you!!! half done!
it just doesn't work that way in general. Here it is necessary that all this chain was. because next to it there is something very similar with class a1 and form-group b, and you also need to go
there too //div/div/input[contains(@class, 'cccc')]
only in the first div (and in the second classes are different. type a2 and b2, which is typical - b1 is also described with two classes "form-group b2"
therefore the question is - how to write the whole chain?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question