为什么 selenium.keyPressNative() 会导致 SeleniumServer 实例冒泡到表面?

发布于 2024-09-30 20:12:27 字数 737 浏览 1 评论 0原文

首先,一些可能有用的信息: 我在 Mac OS X 10.6.4 上运行 Selenium RC 1.03。 我正在使用以下 shell 脚本启动 SeleniumServer:

cd ~/Selenium/selenium-server-1.0.3/
java -jar selenium-server.jar

并使用以下代码从 Automator 操作内部调用它:

~/Selenium/selenium-server-1.0.3/start_selenium.sh&

我正在尝试使用 selenium 中的 keyPressNative() 方法,使用以下代码行将 Tab 键发送到浏览器:

getSeleniumInstance().keyPressNative(java.awt.event.KeyEvent.VK_TAB + "");

getSeleniumInstance() 方法是实例化 DefaultSelenium 的包装器。现在的问题是,每当我在测试用例中调用 keyPressNative() 方法时,我的 Mac 都会播放默认铃声,正在运行的 SeleniumServer 实例(作为后台进程运行)突然出现在 Dock 中,并且我的测试失败。

我认为这可能是我的包装方法的问题,但我尝试过的所有其他硒方法都有效(check()、click()、type()、isVisible() 等)。有什么想法吗?

First, some info that might be useful:
I'm running Selenium RC 1.03 on Mac OS X 10.6.4.
I'm starting the SeleniumServer using the following shell script:

cd ~/Selenium/selenium-server-1.0.3/
java -jar selenium-server.jar

and calling it from inside an Automator action with the following:

~/Selenium/selenium-server-1.0.3/start_selenium.sh&

I am trying to use the keyPressNative() method in selenium to send the tab key to the browser using the following line of code:

getSeleniumInstance().keyPressNative(java.awt.event.KeyEvent.VK_TAB + "");

The getSeleniumInstance() method is a wrapper for instantiating DefaultSelenium. Now, the problem is that whenever I call the keyPressNative() method inside a test case, my Mac plays the default chime, the running SeleniumServer instance (which is running as a background process) suddenly shows up in the Dock, and my test fails.

I thought it might be a problem with my wrapper method, but every other selenium method I have tried works (check(), click(), type(), isVisible() and etc.). Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沐歌 2024-10-07 20:12:27

这样可以吗:

getSeleniumInstance().keyPressNative(String.valueOf(KeyEvent.VK_TAB));

Would this do it:

getSeleniumInstance().keyPressNative(String.valueOf(KeyEvent.VK_TAB));

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文