Elements can be found but not clicked when adding (xpath)[1]
What are you trying to achieve?
Click an Element.
What do you get instead?
invalid selector: An invalid or illegal selector was specified
(Session info: chrome=65.0.3325.181) (Driver info: chromedriver=2.36.540469 (1881fd7f8641508feb5166b7cae561d87723cfa8),platform=Mac OS X 10.12.6 x86_64)
Provide console output if related. Use
--verbosemode for more details.
• I wait for element {"xpath":"(.//[@class='ui-corner-all' and text()='Open/Create'])[1]"}, 100 ("0.023 sec") • I click {"xpath":"(.//[@class='ui-corner-all' and text()='Open/Create'])[1]"} ("0.012 sec")
Provide test source code if related
<a href="/sam/admin/registration/new_event.php" bonzigets="regType=participant&doNew=1" id="ui-id-429" class="ui-corner-all" tabindex="-1" role="menuitem">Open/Create</a>
(.//*[@class='ui-corner-all' and text()='Open/Create'])[1]
Is a legal xpath found by nearly all xpathing tools except codeceptjs I click, but is found by waitforelement? What am I missing?
I solved my problem in a kinda roundabout way by rewriting the xapth like ".//[text()='Registrant']/following::[text()='Open/Create']"
I have another engineer here that says he has seen issues sometimes with (xpath)[1] and similar xapths. I do think there might be something funky going on in codeceptjs, it seems like it's not escaping all the extra () or [] correctly or something?
Also it doesn't always happen for me, some similar xapths like "(.//*[text()='Leagues & Tournaments'])[1]" have worked with codeceptjs for me in the past.
@Jtech42 There was a similar ticket #989 which was then fixed in v1.1.7. Can you try again with v1.1.7?