0

I have this html :

<div class="dropdown float-right">
    <button class="btn btn-default" type="button" id="export-button" data-toggle="dropdown">
        <i class="the-download-export"></i>
                Export
    </button>
    <div class="dropdown-menu dropdown-menu-right"><div class="dropdown-item action-export" data-format="csv" data-store="com" data-reverse-type="single"><i class="text-primary fa fa-upload" aria-hidden="true"></i>Download File</div>

This is a dropdown that has a few options. When the button is clicked, it collapses the dropdown selection and the divs appear(there are more divs for various data formats which i haven't added here for simplicity).

I have tried a few things in order to click the button with the csv data format, but everything has failed. Either not finding it or getting the div only, which is not interactible.

What is the proper way of selecting and clicking this dropdown collapsible button in Python ?

1 Answer 1

1

That's very little to work on.

I can recommend either checking whether you can get the data another way (e.g. api call when clicking the button) or something with x-path like

button = getFromXPath(".//button[@id='export-button']")
button.click()
Sign up to request clarification or add additional context in comments.

3 Comments

Unfortunately no API, i could proxy the traffic, but I really want to avoid that, this is mostly why i picked selenium. I have been able to make everything work so far but this dropdown button. It's a weird one. I will try your suggestion now and will let you know, thanks !
This actually almost worked. It basically collapsed the dropdown and presented me with the selection divs("Download as CSV", "Download as EXCEL") etc.. Now it looks like the collapsed div has to be clicked again, but maybe that first step to collapse the selector was required. I'll see if i can come up with the second click selector, this looks like it's close. If you have any ideas, please let me know, thanks a lot !
I got it ! It needed two clicks it looks like. Once I used your click, it looks likes it made the div click interactible. Works like a charm now thanks !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.