Click on a certain part of the webpage only using Javascript
-
05-12-2019 - |
Question
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?
No correct solution
OTHER TIPS
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?
https://developer.mozilla.org/en/DOM/event.initEvent
There is also a initMouseEvent...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow