Basically I want to find out the login form when there are multiple forms
on a HTML document. My guess is as following: What if i can identify to which form strings like 'forgot your password'
or 'Remember me'
or 'keep me signed in'
belongs then it might be login form since such strings/link appear after the password field.
Is there any way i can find out which form contains these strings/links and then use that form 's name or ID in my app ?
Update: I used following code to get form ID which contains strings 'forgot your password' but it returns nothing.
NSString *formID = [NSString stringWithFormat:@"%@",[self.browser stringByEvaluatingJavaScriptFromString:@"$('form').filter (function() {var text = this.innerHTML.toLowerCase();"
"return text.indexOf('forgot your password') != -1 || "
"text.indexOf('remember me') != -1;}).attr('id');"] ];
Or simply with
:contains
::contains
selector docs:LIVE DEMO
Update:
If you are not sure about the case of the text, you must use
filter
: