0

Here is the HTML from the website:

Unique sequence file: 
<a href="/cgi-bin/elimdupesv2/elimdupes.cgi?id=4ROEFYUD&amp;output=unique_default.Fasta">View</a> 
<a href="/cgi-bin/elimdupesv2/elimdupes.cgi?id=4ROEFYUD&amp;download=unique_default.Fasta">Download</a>

What's displayed:

Unique sequence file: View Download

The download link changes every run because a different file is produced. How should I extract the URL and save it into a variable to download the file? I tried this but it didn't work:

class Example(BaseCase):

def test_(self):
    ...
    url = self.find_link_text('Download', timeout=None).get_link_attribute()
    self.download_file(file_url, destination_folder=None)

Thanks a bunch in advance.

Michael Mintz
  • 9,007
  • 6
  • 31
  • 48
funyuns
  • 229
  • 1
  • 9

1 Answers1

0

you can use this:

element = driver.find_element_by_link_text("Download")

Or this:

driver.find_element_by_xpath("//a[contains(text(), 'Download')]")