Selenium无法点击 [英] Selenium fails to click

查看:166
本文介绍了Selenium无法点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

selenium.click([xpath to object])

硒点击方法似乎搞砸了。它识别我想要点击的按钮并认为它点击它。但屏幕上没有任何反应。下一行涉及单击下一个屏幕上的另一个按钮。它失败了,因为它无法找到按钮,因为第一次点击实际上并没有发生。

Selenium click method seems to be screwed up for me. It recognises the button I want to click and thinks it clicks it. But nothing happens on the screen. The next line involves clicking another button on the next screen. It fails because it cant locate the button because the first click hasn't actually happened.


看起来它只是无法点击后屏幕变化。它将点击登录按钮,然后加载新屏幕。下一次点击失败,但是如果我轻轻推送(IE点击它的按钮),脚本中的所有跟随点击运行正常。所以在屏幕更改后点击似乎是一个问题?

It looks like It just fails to click after the screen changes. It will click the log in button fine, and load the new screen. The next click fails, but if i give it a gentle push(IE click the button for it) all the followin clicks in the script run fine. So it seems to be a problem with a click after a screen change?

推荐答案

我遇到了类似的问题,这段代码适用于我:

I had a similar problem and this code worked for me:

    mouseOver(locator);
    mouseDownAt(locator, "10,10");
    mouseUpAt(locator, "10,10");

我将它包装在clickButton()方法中并使用它代替click()

I wrapped it up in a clickButton() method and use it instead of click()

这篇关于Selenium无法点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆