我是 PhantomJS 的新手,我正在尝试使用 phantomjs 驱动程序运行我的硒测试(python),但它不会是 web 元素。
幽灵驱动程序日志:
[INFO - 2015-02-27T15:24:40.236Z] GhostDriver - Main - running on port 52653
[INFO - 2015-02-27T15:24:41.075Z] Session [bfd397f0-be94-11e4-ad03-b711254501c8] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.0.0 Safari/538.1","webSecurityEnabled":true}
[INFO - 2015-02-27T15:24:41.075Z] Session [bfd397f0-be94-11e4-ad03-b711254501c8] - page.customHeaders: - {}
[INFO - 2015-02-27T15:24:41.075Z] Session [bfd397f0-be94-11e4-ad03-b711254501c8] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.0.0","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"mac-10.9 (Mavericks)-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO - 2015-02-27T15:24:41.075Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: bfd397f0-be94-11e4-ad03-b711254501c8
[ERROR - 2015-02-27T15:24:47.242Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1425050687190
:262 in error
有趣的是,在我成功安装了 phantomjs 之后,我运行了我的登录测试,它顺利通过了。然后我运行了另一个测试,但由于上述相同的原因而失败。我尝试再次运行已通过的登录测试 - 但 phantomjs 驱动程序将不再找到这些元素。
知道是什么原因造成的吗?
顺便说一句,这些测试在 chrome 和 FF 上运行良好