简体   繁体   中英

Clicking JavaScript in Ruby/Watir

Is there ANY way to click a JavaScript link using the Watir webdriver? I've looked around for hours and nothing has helped me.

Here's what the link looks like: <a href="javascript:void(0);" id="double_your_btc_link2" class="bold">MULTIPLY YOUR BTC</a> <a href="javascript:void(0);" id="double_your_btc_link2" class="bold">MULTIPLY YOUR BTC</a> I've tried using browser.link(:id, "double_your_btc_link2").click and a bunch of other stuff including Xpath (it kept saying it couldn't follow the path) and nothing works. Is it even possible?

If you need the page, here it is.

那应该是:

browser.link(:id => "double_your_btc_link2").click

Sorry to waste your time, guys. I just used Firefox instead of Chrome and it worked fine. This isn't even the first time I've had a problem with accessing JavaScript elements in Chrome...thanks anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM