使用selenium扩展动态div

2024-10-03 04:39:53 发布

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

如何展开最初折叠并在单击时展开的每个div, 就像给定链接中的那个 Expanding div

我用selenium尝试过,通过使用xpath获取div类,然后让它单击它,但问题是有时发现div两次,然后再次单击, 所以它又塌了,又影响了它, 我也试过睡觉,但没用

同样,在单击div类之后,更改为:

djl87 job_listings fbw9 browse_startups_table_row _a _jm expanded

while True:
    temp=self.driver.find_element_by_xpath("//div[@class=' djl87 job_listings fbw9 browse_startups_table_row _a _jm']")
    action.move_to_element(temp)
    time.sleep(4)
    action.click() 
    action.perform()
    if(some_cond):
        break

Tags: div链接tablejobactionelementxpathtemp