1

我是 Nightwatch 的新用户,正在尝试转换大量测试以使用最新版本的 Nightwatch 1.1.12。我的要求是使用以下设置:

Nightwatch 1.12.1
Firefox 60.8.0esr and Chrome 74
Gecko driver 1.7.1  (equates to gecko driver 0.17.1) 
see https://github.com/vladikoff/node-geckodriver#readme

我在我的仓库中从 Nightwatch 网站仓库https://github.com/nightwatchjs/nightwatch-website-tests克隆了一个示例设置和测试:

https://github.com/kblodget/nightwatch-website-tests-config

我已经修改了 homepage-test.js 测试移动到 GitHub 按钮,点击它,然后验证 GitHub 页面是否打开。

此测试适用于 chrome,但当我使用 FireFox 和所需的壁虎驱动程序运行相同的测试时失败。火狐的错误是

TimeoutError: An error occurred while running .moveToElement() command on <Section [name=indexContainer],Section [name=download],Element [name=@gitHubButton]>:
   {"status":-1,"value":{"error":"unknown command","message":"POST /session/28e06a8d-7e6c-436a-81b7-149230ff226b/moveto did not match a known command","stacktrace":"stack backtrace:\n   0:           0x57af6d - backtrace::backtrace::trace::h59229d13f6a8837d\n   1:           0x57b0c2 - backtrace::capture::Backtrace::new::h23089c033eded8f0\n   2:           0x4472fc - webdriver::error::WebDriverError::new::h0b226f62ff19e120\n   3:           0x439986 - <webdriver::server::HttpHandler<U> as hyper::server::Handler>::handle::h8a591087754286a9\n   4:           0x42d1cf - hyper::server::listener::spawn_with::{{closure}}::h82d502303a553f20\n   5:           0x4092d7 - std::panicking::try::do_call::h89ac8aec5c3b6b89\n   6:           0x5de23a - panic_unwind::__rust_maybe_catch_panic\n                        at /checkout/src/libpanic_unwind/lib.rs:98\n   7:           0x41bd6e - <F as alloc::boxed::FnBox<A>>::call_box::h2822c178036f43e7\n   8:           0x5d68d4 - alloc::boxed::{{impl}}::call_once<(),()>\n                        at /checkout/src/liballoc/boxed.rs:650\n                         - std::sys_common::thread::start_thread\n                        at /checkout/src/libstd/sys_common/thread.rs:21\n                         - std::sys::imp::thread::{{impl}}::new::thread_start\n                        at /checkout/src/libstd/sys/unix/thread.rs:84"},"errorStatus":"","error":"POST /session/28e06a8d-7e6c-436a-81b7-149230ff226b/moveto did not match a known command","httpStatusCode":404}
       at <anonymous>
       at process._tickCallback (internal/process/next_tick.js:188:7)

我已经通过过去的问题对此进行了研究,并认为该问题与此有关

https://github.com/nightwatchjs/nightwatch/issues/1664

从这个来源来看,gecko 驱动程序不支持 moveTo 命令命令,并且已被 Actions API 实现所取代。

有趣的是,当我更新 nightwatch.conf.js 文件以使用 Firefox 版本 60 和 gecko 驱动程序到 1.16.2(gecko 驱动程序 v0.24.0)时,我有同样的错误

那么如何在 Firefox 60 浏览器中运行这些测试呢?如果我需要创建自定义命令来使用 API 操作,那是如何完成的?

更新1:

我意识到这是 geckodriver 没有完全实现 WebDriver 标准或与 Selenium 完全兼容的问题,但我需要一种方法来修复这些测试。

4

0 回答 0