转:web自动化---报错 Element * is not clickable at point,Other element would receive the click

出现报错Other element would receive the click:的原因是;

当你selenium中click()点击事件时,所选中的标签被外部div吸收了,因此

解决办法就是进入里面进行点击操作 。driver.execute_script("arguments[0].click();", lists[i])

Python执行script代码即可。

 

 

http://www.python66.com/bbs/221.html

 

 

 

调整后的代码运行的很流畅:

            print("开始抓取%s第%s页..." % (self.searchkw , self.page_num))
            try:
                nextbutton = self.driver.find_element(By.XPATH, '//nav[@role="navigation" and @aria-label="'+self.searchkw+' 的更多搜索结果"]//ul//li[last()]//a')
                #nextbutton.click()
                self.driver.execute_script("arguments[0].click();", nextbutton)
            except:
                nextbutton = self.driver.find_element(By.XPATH, '//ul[@class="sb_pagF"]//li[last()]//a')
                #nextbutton.click()
                self.driver.execute_script("arguments[0].click();", nextbutton)

 

 转自:https://www.cnblogs.com/meblogs-08/p/16830156.html

posted @ 2023-03-02 17:59  河北大学-徐小波  阅读(218)  评论(0编辑  收藏  举报