0

I am trying to click on a link in a webpage (which is always a different hyperlink but has the same text e.g. "Prev Day") with UIWebView. How can I do this once a UIButton is touched?

This is the HTML code (just of the link which needs to be clicked) of the webpage:

<tr><td><DIV align=center><A class=ROLLOVER href=" http://www.dhsb.org/index.phtml?d=201435&amp;de=0&amp;my_child_timetable_date=1322638827" t="e" v=" http://www.dhsb.org/index.phtml?d=201435&amp;de=0&amp;my_child_timetable_date=1322638827"><FONT size=2>Prev Day</FONT></A>

Maybe the UIWebView can look for the text "Prev Day" then look for a hyperlink associated with it and click on it?

1 Answer 1

1

You can inject javascript into the UIWebView to click the link, e.g.

var fonts = document.getElementsByTagName('font');
for(i=0;i<fonts.length;i++) {
  if (fonts[i].innerHTML == 'Prev Day') {
    fonts[i].parentNode.childNodes[0].click();
    break;
  }
}
Sign up to request clarification or add additional context in comments.

1 Comment

this doesn't work unfortunately. Is there another way of doing this? :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.