0

I'm trying to do some screen scraping, and I've gotten down to this last step. I'm trying to download a file, which is accessed via a button from the following html:

<button class="pdf ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">
<span class="icon-32 pdf-32"></span>
<span class="btn-txt"> PDF file </span>

I'm used to clicking buttons with the following ruby code:

browser.button(:value, "Sign In").click

But with this .. there doesn't seem to be any value I can use. Can anyone help me out?

awojo
  • 907
  • 3
  • 11
  • 21

1 Answers1

0

I can think of a couple possibilities. One is that you can do a regular expression match on the value. Try:

browser.button(:value, /PDF file/).click

But you don't have to use the value, you can use a uniquely identifying attribute. In this case, you may be able to use the class, e.g.

browser.button(:class, "pdf").click

If the pdf class is not unique, you can add an :index to identify which one of the matches to click.

Mark Thomas
  • 37,131
  • 11
  • 74
  • 101