Could you please help me? I have a button which I need to click on. Checking it in the console, the XPath of this button returns 2 elements and I need to click on the 2nd one. So, at least these 2 locators are returning correctly my button: ("//a[@href='/organization/createorganization']")[1] ("//*[text()='mybuttonText']")[1]
I´m trying to create an automated test using Karate.
- def temp = locateAll("/a[@href='/organization/createorganization']")
- match karate.sizeOf(temp) == 2
- temp[1].click()
My problem is that the size of temp is always 0.That means it doesn't find the locator?! Why wouldn´t find the locator? I tried also to introduce a delay, sleep time, the result is always the same. I can see visually when running the test that it doesn't click on the button. I´ve tried with both XPaths that I mentioned above and other XPaths that I could have come up with, but I get always the same - 0.
Please, do you have any ideas how to solve this?
Thanks a lot in advance.