单击页面源中不可见的按钮(仅在检查中)

时间:2017-06-09 02:09:28

标签: javascript google-chrome tampermonkey

每当按钮显示时,我都会尝试单击按钮。但是,当按钮显示时,在Google Chrome的页面源中,不显示实际的URL。这是来源:

 <div id="fname2"  style="display:none" > Description1  <br/> <span> Description2    </span></div> 

    <div id="fname"><h1 class="ThreeDee"> Preparing Your Links....<br/> Please wait...</h1></div>
    <div id="hata" style="display:none" > Failed to Create Links..  <br/> <span>Please Restart your link Translation . </span></div>
    <div id="vip" style="display:none" > None This Link Download your consent  <br/> <span> More Description1.. </span></div>

</div>
<div id="buton" style="display:none">
  <div class="info-link right" >
    <a href="#">Download</a>
  </div>
</div>

#是当前页面的链接(它是超链接),它应该是下一页的URL。然而,当我按下“检查”按钮后:

<div id="wrapper">
    <div class="main-menu clearfix">


    </div>
<center><a href="http://example.com/" target="_blank" rel="noreferrer" data-ss1496972790="1"> <img src="./images/example.png"></a></center>





      <div class="info-v3 clearfix">
        <div class="info-txt left">

      <div id="fname2" style=""> Created to download Links  <br> <span> Download your Download Push Button  </span></div> 

            <div id="fname" style="display: none;"><h1 class="ThreeDee"> Preparing Your Links....<br> Please wait...</h1></div>
            <div id="hata" style="display:none"> Failed to Create Links..  <br> <span>Please Restart your link Translation . </span></div>
            <div id="vip" style="display:none"> None This Link Download your consent  <br> <span> This file is a private Vip our users.. </span></div>

        </div>
        <div id="buton" style="">
          <div class="info-link right">
            <a href="http://thedownloadlink.com" data-ss1496972790="1">Download</a>
          </div>
        </div>


      </div>



          </div>

知道如何点击按钮吗?谢谢!

2 个答案:

答案 0 :(得分:0)

链接必须是JS的副作用。您无法在源代码中看到JS所做的更改。 JS是客户端 。它在浏览器上执行。但是,您可以在inspect元素中看到。

源代码并没有显示执行JS的副作用。它显示从服务器获取的页面。

答案 1 :(得分:0)

您可以将waitForKeyElements与jQuery的:visible选择器一起使用,只有在显示该按钮后才能点击该按钮。

类似的东西:

waitForKeyElements (
    "#button:visible", 
    clickButtton
);

function clickButton(jNode) {
jNode.click();
}