Click on a certain part of the webpage only using Javascript

By : r3dd3x

How can I inject some Javascript into a UIWebView to click on a certain pixel (e.g. 100 pixels in from the left)?

I have the following code but I don't know the Javascript part:

NSString *ClickJSString = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource: @"ClickJavascript" ofType: @"txt"] usedEncoding:nil error:nil];

[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:ClickJSString]];

The "ClickJavascript.txt" file is what I need to place the Javascript in.

Any ideas?

By : r3dd3x


Can you explain it a little more?
Do you want to click a button or another HTML element?
Am I right, you like to trigger a click event on the page?
There is also a initMouseEvent...

By : Nabor

This video can help you solving your question :)
By: admin