你好,我找不到一种方法,使硒点击…页面上的按钮,如:https://www.instagram.com/p/B9LHHvygBnz/
其中帖子边角的三个点的源代码如下:
<div class="MEAGs">
<button class="wpO6b " type="button">
<div class=" Igw0E rBNOH YBx95 _4EzTm " style="height: 24px; width: 24px;">
<svg aria-label="More options" class="_8-yf5 " fill="#262626" height="16" viewBox="0 0 48 48" width="16">
<circle clip-rule="evenodd" cx="8" cy="24" fill-rule="evenodd" r="4.5"></circle>
<circle clip-rule="evenodd" cx="24" cy="24" fill-rule="evenodd" r="4.5"></circle>
<circle clip-rule="evenodd" cx="40" cy="24" fill-rule="evenodd" r="4.5"></circle>
</svg>
</div>
</button>
我已经尝试了尽可能多的方法,但selenium没有指出它,例如,我尝试过:
self.driver.find_element_by_xpath("//div[@class='MEAGs']")和
posts = self.driver.find_elements_by_xpath("//div[@class='wpO6b ']")还有很多其他的方法(我已经在这行代码上工作了两天了!)
发布于 2020-03-02 03:57:48
您应该始终尝试单击可以接收单击的元素,在本例中是在button上
xpath://div[@class='MEAGs']/button
https://stackoverflow.com/questions/60478655
复制相似问题