我的selenium instagram机器人的xpath单击个人资料,而不是弹出类似框

时间:2018-11-29 01:54:01

标签: python selenium xpath instagram

Liked by user_name and 990 others

如果您熟悉instagram,这就是单击图片时页面底部的样子,并且由于某种原因,无论我选择哪种xpath,它都单击“ user_name”而不是“ 990个其他”。简单的时候:

990 likes

它完美地工作。相信我,我已经尝试过各种xpath:

//a[contains(@href, 'liked_by')]
//a[@class = 'zV_Nj']
//a[@class = 'zV_Nj']/span
//section/div/div/a/span

我尝试使用此xpath专门避免使用“ user_name”配置文件:

//section/div/div[2]/a[2]

但是没有任何效果,它会不断单击配置文件。有人可以向我解释我做错了什么吗?我的目标是弹出“喜欢者”框。我已经呆了几个小时了,请帮忙。

<section class="EDfFK ygqzn">
<div class="                  Igw0E     IwRSH      eGOV_     ybXk5   vwCYk                                                                                                               ">
<div class="                  Igw0E     IwRSH      eGOV_         _4EzTm                                       ItkAi                                                                       ">
<div class="                  Igw0E     IwRSH      eGOV_     ybXk5    _4EzTm                                                                                                              ">
<div class="KcRNL QnLYV  ">
<span class="_2dbep " role="link" tabindex="0" style="width: 20px; height: 20px;">
img class="_6q-tv" src="https://scontent-frt3-2.cdninstagram.com/vp/6e8be84d80c13692826b2ed1d22ecd37/5C8AFF58/t51.2885-19/s150x150/26066662_205753880002771_3331346998950363136_n.jpg" alt="ewapelak's profile picture">
</span>
</div>
</div>
</div>
<div class="Nm9Fw">
Liked by 
<a class="FPmhX notranslate cqXBL" title="ewapelak" href="/ewapelak/">ewapelak</a> 
and 
<a class="zV_Nj" href="/p/Bqrkrc5Fpwo/liked_by/">
<span>994</span> others
</a>
</div>
</div>
</section>

0 个答案:

没有答案