tim blue
tim blue

Reputation: 138

Get HTML Element - Obj-c

I have a web view and some html that looks like this

<li>
    <a herf="/reference.dca?iigg=23789d2a9000efd0d80a176ebbaf48d5&zzxx=4945271518265d2358b075c3af020e38&cdx=logoff&userLevel=3"> Logoff </a>
</li>

And I am trying to click this button with something like this

[self.webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByClass('li')[0].click();"];

But I can't get it to work, how can I click this button?

Thanks for the help in advance.

Upvotes: 1

Views: 96

Answers (1)

mpallansch
mpallansch

Reputation: 1194

getElementsByClass is not a function, you should use getElementsByTagName.

Upvotes: 1

Related Questions