0
votes

I've written a script using vba with selenium. Firstly it gets to the main page then placing the word "pump" in the search input and finally select them all by ticking in the checkbox. It is working fine until it comes to select the checkbox. However, upon reaching that line, it throws an error "element not visible". Apparently, it seems that I did nothing wrong. I would be very happy if somebody points out what I'm missing here:

Sub table_data()

Dim driver As New WebDriver

With driver
    .Start "chrome", "http://apps.tga.gov.au/Prod/devices"
    .get "/daen-entry.aspx"
    .Wait 3000
    .FindElementById("disclaimer-accept").Click
    .Wait 3000
    .FindElementById("medicine-name").SendKeys ("pump")
    .Wait 5000
    .FindElementById("medicines-check-all").Click   ''element not visible here
    .Wait 3000
End With
End Sub

Html elements for the section where element should be stored:

<span id="medicine-widget-header-wrapper">
                            <span id="medicine-widget-header">
                                <label title="Select all">
                                    <input type="checkbox" class="medicines-check-all">
                                    <span id="medicines-header-text">Devices found for 'pump...'</span>
                                </label>
                                <span id="medicine-selected-count">None selected</span>
                            </span>
                        </span>

Here is the link:

"http://apps.tga.gov.au/Prod/devices/daen-entry.aspx"

2
"medicines-check-all" is not an ID, but class name - Andersson

2 Answers

2
votes

According to provided HTML sample, "medicines-check-all" is not a value of ID attribute, but of class name attribute, so you should try

.FindElementByClassName("medicines-check-all").Click 

instead of

.FindElementById("medicines-check-all").Click 
0
votes

Instead of clicking on checkbox, you can try with clicking on label as given below.

.FindElementById("medicines-header-text").Click