knucklesCZ Posted March 24, 2015 Posted March 24, 2015 (edited) Hello coders. I've been working with the FF.au3 extension which allows user to do things in Firefox via javascript (_FFCmd function sends javascript and then returns values) But in a lot of cases, there may come handy a javascript function, and now I found that it is probably essential to implement one. The case is:http://stackoverflow.com/questions/15055185/document-getelementsbyclassname-exact-match-to-class I've got elements with class "item" and class "item one" if I do _FFCmd("someMoreThings.getElementsByClassName('item')") , it picks the items "item one" also. I need to pick only "item". That issue is solved by a javascript/jquery function on stackoverflow forum. How can I do something like that in AutoIt? Thanks for help, Knuckles EDIT: I'm thinking of using something like this: document.getElementsByClassName('item' && !'item one'); JSLint says Weird condition. (so it's probably not the right way to do it) Edited March 24, 2015 by knucklesCZ
Kyan Posted March 24, 2015 Posted March 24, 2015 Some people say thar SRE in html is madness, but I still use it xD SRE: $rex = StringRegExp($htmlPage,'(?ims)<div class="item">(.+?)</div>',3) ;returns an array Matching where the string beggins and where the </div> is used $Start = StringInStr($htmlPage,'class="item">') ;matches the beginning of class="... $end = StringInStr($htmlPage,'</div>',0,1,$Start) ;matches the char count of </div> (began matching it from $Start) $match = StringMid($htmlPage,$Start+13,$end-$Start-12) Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Danp2 Posted March 25, 2015 Posted March 25, 2015 Have you looked at using _FFXPath? Latest Webdriver UDF Release Webdriver Wiki FAQs
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now