python中提示单击被拦截,ElementClickInterceptedException:元素点击被拦截:

I'm trying to submit one form on wordpress plugin using selenium + python. When I press publish button , it is giving an error.

ElementClickInterceptedException: element click intercepted: Element

type="submit" name="publish" id="publish" class="button button-primary button-large" value="Publish"> is not clickable at point (728, 15). Other element would receive the click:

...

I have tried following solutions:

Used action driver, but it didn't work.

Used webdriverwait() function, it didn't work.

Used Xpath, CSS selector, ID - It's giving same error in all three.

` browser.find_element_by_css_selector("""#save-post""").click()

WebDriverWait(driver, 90).until(EC.element_to_be_clickable((By.ID, "save-post"))).click()

`

Note that when I run that specific line in python console, it is working. But while running the full script, it is showing error.

There are so many similar questions on portal but none of them worked. Kindly help me to solve this issue.

解决方案

ok, the answer is in error message - "Other element would receive the click: ..."

I had the same problem when I just started using selenium, couldn't figure out what's the problem. "Other element would receive the click: ..." means there is other element above(overlapping) your element(pop up window, page is grayed out(disabled while loading, Some JS running)), so when Selenium trying to click on your element its actually clicking on that blocking element. Selenium is running really fast and clicking before its become clickable, that's why u are not able to click on it - "when I run that specific line in python console, it is working" Try to click after time.sleep() 5-10 sec. If this is the case then you can use wait or add condition before find your element to check that element that prevent from clicking on you element is not there then u click on your element.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值