IBM Business Automation Community Come for answers. Stay for best practices. All we’re missing is you. Join / Log in Ask a question
I have a problem using click on webpage,
Is it possible to put a wildcard in the CSS path? Because the CSS code sometimes changes some random number. So when I re-run the bot, it clicks anywhere, not in the point I mapped.
This is the code:webClick --selector "CssSelector" --css "#tm1web_workbook_GridPane_0 > div.tm1webGridPaneContainer > div:nth-child(3) > div.tm1webGridCell.s_16874034838120_f_ssS0.s_16874034838120_f_ssS0R4.s_16874034838120_f_ssS0C1.s_16874034838120_f_ss28.tm1webGridCellString" --simulatehuman --comment SiteCell
Hi John! You can definitely make the CSS more dynamic. I would highly recommend trying to make it more specific, like using tags and attributes that are unique to the element you are targeting. Most of the time, using the full CSS selector will result in a match that won't adapt very well to minor website changes.
Here are some strategies you can use to make the selector more robust: https://www.w3schools.com/cssref/css_selectors.php
Please note that if you want to also match by text (useful when no tag/attribute can be easily found), then you should consider using XPath instead of CSS.
Hi Vinicius! Thank you for the reply. I tried using Xpath, it works! I will try the selector in css.Thank you!