I have a CSS selector value that is sometimes appended with -prevClone. Is it possible to set the selector editor so it looks for the presence of sponsored-#### within the first selector field? Screenshot showing the two selectors follows…
It seems to find it, which is awesome! Thanks! Oddly, not on the first time - it rotates through the carousel a few times then finds the item I’m looking for (the id value is different each time it actually does click it so there’s something more going on that I need to dive into). I’ll post about that separately - this seems to be the solve for this particular issue. Thanks!
For future me, I adjusted the Selector Editor on the object to be…
[id*=sponsored-14395] > div > div.actions.product__actions > div.actions__alignmentContainer > button
Just a sidenote on this (sorry to beat a dead horse), I have played around quite a bit with the contains and starts with options (* and ^) but have yet been able to get them working. Are you aware of any bugs with this? The only one I can consistently get to work is ends with ($), everything else results in an error that the object could not be found. Thanks!
Playing around with this some more… I’ve got a theory on what’s going on. I was using the Object Repository Object - CSS selector and feeding that object into WebUI.verifyElementVisible. My guess is that with the start’s with and contains, it’s first finding the first instance of that object in the dom but then saying “hey ya dummy… that isn’t visible.” and failing. When I use cssSelectors from the WebDriver within the scripts themselves, I’m then able to get them to locate the elements with starts with / ends with / contains without issue.
In sum, I think it was how I set this up that didn’t jive quite right.
Last thing on this - because it’s entirely new territory for me - using the above method for object identification, what is the suggested way to identify and act upon an element that is only visible? Again, I can find 3 occurrences-ish of the element with this ID in the dom, but only one of those that I actually want and it seems the element sporadically has postCalone or preClone appended. Maybe feed in a check for either of those CSS selectors, loop through them with an if statement? But I’m not sure how to handle the check for whether it’s visible with the WebDriver method.