Hey on a windows 8 app I want to automatic click on a hyperlink after web page is loaded in the webviewer.. The code for the hyperlink looks like this:
<li class="first"><a class="user-signup ctools-bp-modal" href="http://webpage.com/register"> … </a></li>
the link is to a json file that will open on the page.
now I tried doing it by using both document.getElementByClassName
and document.getElementByClass
like:
signupWebView.InvokeScript("eval", new string[] { string.Format("document.getElementByClassName('user-signup ctools-bp-modal').click();") });
I have also tried with .submit
Is there any way to do this? Thanks
It's getElementsByClassName (plural) and since multiple elements could have the same class, it will return an array of objects. The following code will work, but presumes you know which specific item you want among a potential list of elements with the same given class(es). Perhaps using an id attribute would be safer?
signupWebView.InvokeScript("eval", new string[] { "document.getElementsByClassName('user-signup ctools-bp-modal')[0].click();" });
Note too, the String.Format call is unnecessary.