0

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"

1
  • "medicines-check-all" is not an ID, but class name Commented Jul 10, 2017 at 6:55

2 Answers 2

2

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 
Sign up to request clarification or add additional context in comments.

Comments

0

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

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

Comments

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.