Rewrite the title to: From less information to more information: Auto-click to expand collapse links
P粉037450467
P粉037450467 2023-09-13 09:47:35
0
1
499

I'm trying to use automation to display more information on click of a "more details" link on a popup, but the link doesn't have any id associated with it. When I inspect the link in the Chrome console, it appears to be the "href="#myCollapse"" line in the associated element below. I don't really understand js but tried something like document.getElementById('#myCollapse'). click();...and try to use the child with id="popup-content".

<div id="popup-content">
        <span id="overlayAddress">SCOTTISH PARLIAMENT  1 HORSE WYND OLD TOWN </span><br>
        <span id="overlayTown">EDINBURGH</span><br>
        <span id="overlayPostCode">EH99 1SP</span>
        <br>
            <a href="#myCollapse" data-bs-toggle="collapse" class="collapsed" aria-expanded="false">更多详情</a>
            <div class="collapse" id="myCollapse" style="">
             <label style="color:white;"><b>UPRN :&nbsp;</b></label><span id="overlayuprn">906423108</span><br> 
             <label style="color:white;"><b>POSTAL TOWN :&nbsp;</b></label><span id="overlayPostTown">EDINBURGH</span><br>
             <label style="color:white;"><b>CUSTODIAN :&nbsp;</b></label><span id="overlayCustodian">City of Edinburgh</span><br>
            </div>
        </div>

P粉037450467
P粉037450467

reply all(1)
P粉818306280

Just use the following selector:

document.querySelector('#popup-content a[href="#myCollapse"]').click()
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template