Skip to content

Using the SeleniumBase module in Python, how to get URL of link that changes with each query? #650

@dan-ieljin

Description

@dan-ieljin

Here is the HTML from a website I'm working with:

<pre>
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>
<pre>

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionSomeone is looking for answers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions