2

I am trying to find an element that RF can locate. I tried Click Element, Click Link, and Mouse Down with now luck.

<a class="navHREF " href="#" onclick="return swap_interior_nav('6');">
    <span class="glyphicon glyphicon-circle-arrow-down" id="span_1_6"></span>
    Inventory
</a>

I have tried the below XPath and can’t seem to make it work

//a[contains(.,'Inventory')]

I can make it work with below, however, this link dynamic based on user permissions so the order can change of this function.

html/body/div[4]/div[2]/div[2]/ul/li[6]/a
A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
rookievmc
  • 173
  • 2
  • 2
  • 13
  • what is the problem? element not found? Element not clickable? Stale element? Syntax error? – Bryan Oakley Jun 06 '17 at 19:48
  • Element was not visible in 5 seconds.. then I added a Sleep 3 and still same thing. – rookievmc Jun 06 '17 at 19:59
  • what's the exact exception? and if you select it by some other attribute (not text), e.g. `//a[contains(@onclick,'return swap_interior_nav')]`, does it get selected or you get the same exception? – timbre timbre Jun 06 '17 at 22:05

1 Answers1

1

Your solution was close and perhaps inspired from this SO Question. The main issue you have is that your trying to access the first text node, whereas you need the second one. The below example works on the provided code.

//a[text()[contains(.,'Inventory')]]
A. Kootstra
  • 6,827
  • 3
  • 20
  • 43