OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Automating a javascript button click

  • Thread starter Thread starter madmod
  • Start date Start date
M

madmod

Guest
So I have a button with code like this:

Code:
<div style="text-indent: 0pt; visibility: inherit;" id="button5061">
    <a title="Continue" href="javascript:if(%20button5061.hasOnUp%20)%20button5061.onUp()" name="button5061anc">
        <img width="82" height="25" border="0" style="cursor: pointer;" alt="Continue" src="images/continueoff.gif" name="button5061Img">
    </a>
</div>

And I need to click it with javascript. Right now I am using the firefox extension Chickenfoot which allows me to script the site with a javascript interpreter with some custom commands.

http://groups.csail.mit.edu/uid/chickenfoot/api.html

I have tried selecting it with xPath (//div/a[@title='Continue']/..) which finds it, but when I click() it nothing happens. Here are some of the things I have tried:

Code:
click(find(new XPath("//img[@alt='Continue']/..")))
click(find(new XPath("//img[@alt='Continue']/../..")))
click("continue")
click("Continue")
click("images/continueoff.gif")
click("continueoff.gif")
click(find("Continue"))
click(find("Continue").element)
click(find("images/continueoff.gif"))

I know this is a rather specific quesiton but any ideas on what to try would be much appreciated.

<p>So I have a button with code like this:</p>

<pre><code><div style="text-indent: 0pt; visibility: inherit;" id="button5061">
<a title="Continue" href="javascript:if(%20button5061.hasOnUp%20)%20button5061.onUp()" name="button5061anc">
<img width="82" height="25" border="0" style="cursor: pointer;" alt="Continue" src="images/continueoff.gif" name="button5061Img">
</a>
</div>
</code></pre>

<p>And I need to click it with javascript. Right now I am using the firefox extension Chickenfoot which allows me to script the site with a javascript interpreter with some custom commands. </p>

<p><a href="http://groups.csail.mit.edu/uid/chickenfoot/api.html" rel="noreferrer">http://groups.csail.mit.edu/uid/chickenfoot/api.html</a></p>

<p>I have tried selecting it with xPath (//div/a[@title='Continue']/..) which finds it, but when I click() it nothing happens.
Here are some of the things I have tried:</p>

<pre><code>click(find(new XPath("//img[@alt='Continue']/..")))
click(find(new XPath("//img[@alt='Continue']/../..")))
click("continue")
click("Continue")
click("images/continueoff.gif")
click("continueoff.gif")
click(find("Continue"))
click(find("Continue").element)
click(find("images/continueoff.gif"))
</code></pre>

<p>I know this is a rather specific quesiton but any ideas on what to try would be much appreciated.</p>
 

Latest posts

Top