1

I'm unable to tick/click checkbox on IE (through VBA) and it seems I have tried a lot of methods already. Can you please advise?

FYI Elements:

<div class="bordered_table" id="mig-to-prod"> <div class="edl_checkbox floatleft"> <input type="hidden" name="_selectAllConfigs" value="visible" /> <label class="edl_chb"> <input type="checkbox" name="selectAllConfigs" onclick="changeDropDown(this.form);"> <span></span> 

The checkbox is edl_chb

I have tried:

Html.querySelector("a[title=edl_chb]").Click Html.querySelector("a[title='edl_chb']").Click Html.querySelector("a[title='edl_chb']")(0).Click Html.querySelector("a[title='edl_chb']")(1).Click 

I have also tried to getelemtsbyclassname

3
  • Can you include the URL? Commented Nov 16, 2018 at 9:59
  • Am afraid I can't, it's a corporate website (of some firm) that only works after security login.Sorry Commented Nov 16, 2018 at 10:00
  • Are you getting any error messages? Are you selecting the correct element but simply no check appears? Commented Nov 16, 2018 at 10:04

1 Answer 1

1

Be sure to allow enough time for page to load. This includes having the following after the .Navigate2 line.

While ie.Busy Or ie.readyState < 4: DoEvents: Wend 

For other approaches see here.

You could try an attribute = value combination of

ie.document.querySelector("[type=checkbox][name=selectAllConfigs]").click 

Or

ie.document.querySelector("[type=checkbox][name=selectAllConfigs]").FireEvent "onclick" 
Sign up to request clarification or add additional context in comments.

3 Comments

In the first case I have received an error 424 Object Required, in the second case the same.
Are you 1) Leaving a sufficient wait for page load before this? Can you show the rest of your code? 2) Have you checked the element is not inside a parent frame/iframe? Some further info here
Hi, you were right, I forgot about allowing the page to load in! Do While IEx.Busy Application.Wait DateAdd("s", 1, Now) Loop, solved everything and the first line (solution) worked perfectly! Thanks a lot QHarr

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.