I'm trying to click a javascript element in VBA executescript, but I couldn't do it well and posted it.
Thanks for your professor.

JavaScript error: Cannot read property'click' of null
Corresponding source code

Missing click property? If so, is there an alternative?
Is it written incorrectly in the first place?

driver.ExecuteScript "document.querySelector ('javascript element'). click ();"
What I tried

・ I searched for something that could be replaced with click, but I couldn't find it.

Supplementary information (FW/tool version, etc.)

Reference article

  • Answer # 1

    Let's read the error properly.

    Instead of having no click property
    Attempting to call click from a null object has failed.

    So, I haven't been able to get the element in the first place.

    querySelector returns null if there is no corresponding element.
    In other words, it seems that the element you want to get does not exist.

    Nothing more can be seen from the code presented,
    If it is only the code presented, I think that the writing method is correct.

    However, I don't know how to describe the "'javascript element'" part.

    It is recommended to check the acquired object once.
    So, I think the solution is just to modify the code so that you can get the object.

Related articles