-1

I have an issue that I am facing.

I want to navigate inside a sibling and move to the input tag.

I managed to go to the sibling (since the sibling is the only thing that is unique).

How can I navigate inside the siblings and navigate to the input (the input is only displayed once in siblings)

The Navigate that I have done is:

//tr[contains(@class, 'ng-pristine')]/td[contains(text(),'Native')]

How can I navigate to the input in the purple?

enter image description here enter image description here

CEH
  • 5,701
  • 2
  • 16
  • 40
Bastian
  • 1,089
  • 7
  • 25
  • 74
  • Aren't those `nz-input-number` and `nz-input-group` also unique? Aren't `span` and `input`'s tokens in `class` attribute also unique? – Alejandro Dec 18 '19 at 14:35
  • No I want that the navigation will be uniqe with text from UI not nz-input that can be changed – Bastian Dec 18 '19 at 15:09
  • 1
    I'm confused as to what you are asking. You have two screenshots each of which points to a different element. You referred to wanting the INPUT but no INPUT is shown in the second screenshot. You really should not post screenshots of HTML. It makes it really hard for us to actually do anything with like try out locators, etc. without having to retype all the HTML and I can't imagine anyone is really going to do that. – JeffC Dec 18 '19 at 15:26
  • 1
    It would be better if you 1. took a screenshot of the UI and said I want to find this INPUT (circled) from this text/label (circled). 2. Then post the relevant HTML as text and point out which are the two elements that you referred to in the picture. After posting those two things... 3. a link to the page itself would ensure that we can write a locator to the page and not just the subset of the HTML you posted. #1 and #2 are REQUIRED, #3 is optional. – JeffC Dec 18 '19 at 15:28

1 Answers1

0

To locate the <input> with respect to the element with text as Native you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • xpath:

    //tr[contains(@class, 'ng-pristine')]/td[contains(text(),'Native')]//following::td[2]//span[@class='ant-form-item-children']//span[@class='ant-input-wrapper ant-input-group ng-star-inserted']/nz-input-number//input[@class='ant-input-number-input ng-pristine ng-valid ng-touched']
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352