1

I'm new to Selenium and VBA. What i want to do is automate selection of a certain TEXT in a CSS. Selenium brings me this:

css=.x-grid3-row:nth-child(42) .x-grid3-col:nth-child(4) > .x-grid3-cell-inner

Everyting would be fine, except the TEXT I want to select sometimes move to different grid3-row:nth-child What I want to achieve is to find in which x-grid3-row:nth-child the desired TEXT is so I could click it with a VBA bot.

Thank you for your help.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
baxius
  • 37
  • 8

1 Answers1

1

You won't be able to construct a passing the desired text.

You can find a relevant detailed discussion in selenium.common.exceptions.InvalidSelectorException with “span:contains('string')”

As an alternative you can use a based Locator Strategy as follows:

driver.FindElementByXPath("//*[@class='x-grid3-cell-inner' and text()='certain_text']")
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • that actually really helped. But another problem popped out. I did find my desired text, but it turns out that it can't be clicked, instead there is a cell-inner in the next grid column. Sadly i can't find any similarities of the mentioned grid with the desired text. How to keep the targeted row with the desired text and target the nearby column? – baxius Jun 23 '20 at 13:24
  • @baxius That sounds to be a different question all together. Can you raise a new question with your new requirement please? – undetected Selenium Jun 23 '20 at 13:29