Let’s say I’m trying to scrape some category labels of different blog posts and save them individually to a CSV line.
Each blog post might have one to five categories stored individually in this element:
//article/a
So, to find each category value I can add increments to this Xpath like this:
//article/a[1]
//article/a[2]
//article/a[3]
//article/a[4]
//article/a[5]
However, if a given blog post only has one category, this means that ui.vision will waste quite a bit of time searching for the other four categories that don’t exist and also return several #LNF values in my CSV file.
Is there a way to tell ui.vision something like:
“If //article/a[2] isn’t found, don’t bother looking for //article/a[3], //article/a[4], etc. Just skip to the next part of the scraping process. Also, don’t log #LNF for any category you couldn’t find.”
I’m guessing there are probably a few ways to do this, so I appreciate any workarounds the community here can offer.
Thanks!