mootoo 0 Posted March 15, 2016 Report Share Posted March 15, 2016 Hi, Hope I can expain this clearly. I have a list of links on page and a spreadsheet with text that partially matches the links, Example Link:manchester-park-centre123 Example text:manchester-park-centre I want ubot the click on the link that partially matches the text. When I enter the text manually using regex it works fine. But when I pull the same text from a variable it causes a code error. Anything I need to add to the code so that It can use variables? Thanks for any help with this. Quote Link to post Share on other sites
deliter 203 Posted March 15, 2016 Report Share Posted March 15, 2016 my regex really sucks and is very basic,so I rely on scraping for the most part,like this load html("<a href=\"/manchester-park-centre.html\">manchester</a></BR> <a href=\"/centre.html\">1</a></BR><a href=\"/park-centre.html\">2</a>") set(#myLink text, "manchester-park-centre", "Global") set(#position, 0, "Global") add list to list(%hrefs, $scrape attribute(<tagname="a">, "href"), "Delete", "Global") loop while($comparison(#position, "<", $list total(%hrefs))) { if($comparison($find regular expression($list item(%hrefs, #position), #myLink text), ">", $nothing)) { then { click(<href=$list item(%hrefs, #position)>, "Left Click", "No") set(#position, $list total(%hrefs), "Global") } else { increment(#position) } } } Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.