selenium无法单击instagram站点中的特定按钮

2024-10-03 04:35:44 发布

您现在位置:Python中文网/ 问答频道 /正文

你好,我找不到让selenium点击。。。发布网页上的按钮,如: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 ']")

还有很多其他的方法(我已经在这一行代码上工作了2天!)


Tags: divclipseleniumbuttonwidthrulefillclass