0

I'm trying to switch from Chrome to PhanomJS when running Selenium tests. But it fails with PhantomJS for not clear yet reason.

First, here's what Selenium Server outputs when I run my first test with PhantomJS:

14:40:49.346 INFO - Executing: [new session: Capabilities [{browserName=phantomjs}]])
14:40:49.405 INFO - Creating a new session for Capabilities [{browserName=phantomjs}]
14:40:49.427 INFO - executable: /srv/http/s1/./vendor/bin/phantomjs
14:40:49.427 INFO - port: 27218
14:40:49.427 INFO - arguments: [--webdriver=27218, --webdriver-logfile=/srv/http/s1/phantomjsdriver.log]
14:40:49.427 INFO - environment: {}
PhantomJS is launching GhostDriver...
[INFO  - 2017-01-16T12:40:50.745Z] GhostDriver - Main - running on port 27218
[INFO  - 2017-01-16T12:40:51.074Z] Session [034e39e0-dbe9-11e6-8098-1bc85ede532e] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34","webSecurityEnabled":true}
[INFO  - 2017-01-16T12:40:51.074Z] Session [034e39e0-dbe9-11e6-8098-1bc85ede532e] - page.customHeaders:  - {}
[INFO  - 2017-01-16T12:40:51.075Z] Session [034e39e0-dbe9-11e6-8098-1bc85ede532e] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"1.9.8","driverName":"ghostdriver","driverVersion":"1.1.0","platform":"linux-unknown-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  - 2017-01-16T12:40:51.075Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 034e39e0-dbe9-11e6-8098-1bc85ede532e
14:40:51.079 INFO - Done: [new session: Capabilities [{browserName=phantomjs}]]
14:40:51.158 INFO - Executing: [get current window handle])
14:40:51.164 INFO - Done: [get current window handle]
14:40:51.182 INFO - Executing: [set window size])
14:40:51.233 INFO - Done: [set window size]
14:40:53.219 INFO - Executing: [get: http://s1/])
14:40:54.256 INFO - Done: [get: http://s1/]
14:40:54.274 INFO - Executing: [find element: By.cssSelector: html])
14:40:54.371 INFO - Done: [find element: By.cssSelector: html]
14:40:54.387 INFO - Executing: [find element: By.cssSelector: .login-form])
14:40:54.409 INFO - Done: [find element: By.cssSelector: .login-form]
14:40:54.413 INFO - Executing: [find element: By.id: email])
[ERROR - 2017-01-16T12:40:54.673Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1484570454618
14:40:55.508 WARN - Exception thrown
org.openqa.selenium.NoSuchElementException: {"errorMessage":"Unable to find element with id 'email'","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"30","Content-Type":"application/json;charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"using\":\"id\",\"value\":\"email\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element"}}
Command duration or timeout: 452 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.phantomjs.PhantomJSDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, handlesAlerts=false, databaseEnabled=false, version=1.9.8, platform=LINUX, browserConnectionEnabled=false, proxy={proxyType=direct}, nativeEvents=true, acceptSslCerts=false, driverVersion=1.1.0, locationContextEnabled=false, webStorageEnabled=false, browserName=phantomjs, takesScreenshot=true, driverName=ghostdriver, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 034e39e0-dbe9-11e6-8098-1bc85ede532e
*** Element info: {Using=id, value=email}
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
        at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:413)
        at org.openqa.selenium.By$ById.findElement(By.java:218)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
        at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:103)
        at com.sun.proxy.$Proxy4.findElement(Unknown Source)
        at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:188)
        at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:48)
        at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: EventFiringWebDriver
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:138)
        ... 18 more
Caused by: org.openqa.selenium.NoSuchElementException: {"errorMessage":"Unable to find element with id 'email'","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"30","Content-Type":"application/json; charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"using\":\"id\",\"value\":\"email\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element"}}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: unknown
14:40:55.510 WARN - Exception: {"errorMessage":"Unable to find element with id 'email'","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"30","Content-Type":"application/json; charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"using\":\"id\",\"value\":\"email\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element"}}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: unknown
14:40:55.514 INFO - Executing: [find element: By.name: email])
14:40:55.537 INFO - Done: [find element: By.name: email]
14:40:55.559 INFO - Executing: [send keys: 2 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)] -> name: email], [_, _, t, e, s, t, -, c, r, o, w, d, -, m, a, r, k, e, t, e, r, _, _, @, g, m, a, i, l, ., c, o, m]])
14:40:55.676 INFO - Done: [send keys: 2 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)] -> name: email], [_, _, t, e, s, t, -, c, r, o, w, d, -, m, a, r, k, e, t, e, r, _, _, @, g, m, a, i, l, ., c, o, m]]
14:40:55.680 INFO - Executing: [find element: By.id: password])
[ERROR - 2017-01-16T12:40:55.933Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1484570455885
14:40:56.446 WARN - Exception thrown
org.openqa.selenium.NoSuchElementException: {"errorMessage":"Unable to find element with id 'password'","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"33","Content-Type":"application/json; charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"using\":\"id\",\"value\":\"password\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element"}}
Command duration or timeout: 473 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.phantomjs.PhantomJSDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, handlesAlerts=false, databaseEnabled=false, version=1.9.8, platform=LINUX, browserConnectionEnabled=false, proxy={proxyType=direct}, nativeEvents=true, acceptSslCerts=false, driverVersion=1.1.0, locationContextEnabled=false, webStorageEnabled=false, browserName=phantomjs, takesScreenshot=true, driverName=ghostdriver, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 034e39e0-dbe9-11e6-8098-1bc85ede532e
*** Element info: {Using=id, value=password}
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
        at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:413)
        at org.openqa.selenium.By$ById.findElement(By.java:218)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
        at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:103)
        at com.sun.proxy.$Proxy4.findElement(Unknown Source)
        at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:188)
        at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:48)
        at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: EventFiringWebDriver
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:138)
        ... 18 more
Caused by: org.openqa.selenium.NoSuchElementException: {"errorMessage":"Unable to find element with id 'password'","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"33","Content-Type":"application/json; charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"using\":\"id\",\"value\":\"password\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element"}}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: unknown
14:40:56.449 WARN - Exception: {"errorMessage":"Unable to find element with id 'password'","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"33","Content-Type":"application/json; charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"using\":\"id\",\"value\":\"password\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element"}}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: unknown
14:40:56.452 INFO - Executing: [find element: By.name: password])
14:40:56.468 INFO - Done: [find element: By.name: password]
14:40:56.473 INFO - Executing: [send keys: 3 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)] -> name: password], [1, 2, 3, 4, 5, 6]])
14:40:56.563 INFO - Done: [send keys: 3 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)] -> name: password], [1, 2, 3, 4, 5, 6]]
14:40:56.566 INFO - Executing: [find element: By.cssSelector: .login-form .submit-button])
14:40:56.620 INFO - Done: [find element: By.cssSelector: .login-form .submit-button]
14:40:56.623 INFO - Executing: [click: 4 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)]-> css selector: .login-form .submit-button]])
14:40:57.407 INFO - Done: [click: 4 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)] -> css selector: .login-form .submit-button]]
14:40:57.421 INFO - Executing: [find element: By.cssSelector: html])
14:40:57.480 INFO - Done: [find element: By.cssSelector: html]
14:40:57.483 INFO - Executing: [find elements: By.cssSelector: .site-content .projects-table .c-checkbox])
14:40:57.540 INFO - Done: [find elements: By.cssSelector: .site-content .projects-table .c-checkbox]
14:40:57.544 INFO - Executing: [click: 6 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)]-> css selector: .site-content .projects-table .c-checkbox]])
14:40:57.665 INFO - Done: [click: 6 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)] -> css selector: .site-content .projects-table .c-checkbox]]
14:40:57.668 INFO - Executing: [find element: By.cssSelector: .site-content .action-line .c-select])
14:40:57.727 INFO - Done: [find element: By.cssSelector: .site-content .action-line .c-select]
14:40:57.732 INFO - Executing: [click: 8 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)]-> css selector: .site-content .action-line .c-select]])
14:40:57.815 INFO - Done: [click: 8 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)] -> css selector: .site-content .action-line .c-select]]
14:40:57.819 INFO - Executing: [find element: By.cssSelector: .site-content .action-line .c-select li[data-value=take-projects]])
14:40:57.887 INFO - Done: [find element: By.cssSelector: .site-content .action-line .c-select li[data-value=take-projects]]
14:40:57.890 INFO - Executing: [click: 9 [[PhantomJSDriver: phantomjs on LINUX (034e39e0-dbe9-11e6-8098-1bc85ede532e)]-> css selector: .site-content .action-line .c-select li[data-value=take-projects]]])
14:40:58.420 WARN - Exception thrown
org.openqa.selenium.ElementNotVisibleException: {"errorMessage":"Element is not currently visible and may not be manipulated","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1484570457439\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element/%3Awdc%3A1484570457439/click"}}
Command duration or timeout: 230 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.phantomjs.PhantomJSDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, handlesAlerts=false, databaseEnabled=false, version=1.9.8, platform=LINUX, browserConnectionEnabled=false, proxy={proxyType=direct}, nativeEvents=true, acceptSslCerts=false, driverVersion=1.1.0, locationContextEnabled=false, webStorageEnabled=false, browserName=phantomjs, takesScreenshot=true, driverName=ghostdriver, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 034e39e0-dbe9-11e6-8098-1bc85ede532e
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
        at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
        at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:85)
        at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement$1.invoke(EventFiringWebDriver.java:335)
        at com.sun.proxy.$Proxy2.click(Unknown Source)
        at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.click(EventFiringWebDriver.java:348)
        at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.openqa.selenium.remote.server.KnownElements$1.invoke(KnownElements.java:64)
        at com.sun.proxy.$Proxy3.click(Unknown Source)
        at org.openqa.selenium.remote.server.handler.ClickElement.call(ClickElement.java:30)
        at org.openqa.selenium.remote.server.handler.ClickElement.call(ClickElement.java:1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: RemoteWebDriver
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:138)
        ... 21 more
Caused by: org.openqa.selenium.ElementNotVisibleException: {"errorMessage":"Element is not currently visible and may not be manipulated","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1484570457439\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element/%3Awdc%3A1484570457439/click"}}
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: unknown
14:40:58.422 WARN - Exception: {"errorMessage":"Element is not currently visible and may not be manipulated","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:27218","User-Agent":"Apache-HttpClient/4.5.1 (Java/1.8.0_112)"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1484570457439\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/034e39e0-dbe9-11e6-8098-1bc85ede532e/element/%3Awdc%3A1484570457439/click"}}
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'yuri', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.13-1-ARCH', java.version: '1.8.0_112'
Driver info: driver.version: unknown
[INFO  - 2017-01-16T12:41:01.643Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-upphase starting NOW

Above we can see mythical

Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken

line, which I don't know how to interpret. I didn't set up taking screenshots yet. Also, it's not clear (at least to me) what goes wrong. So I decided to take a screenshot. For that I wrote the following test:

<?php

namespace Tests;

use PHPUnit_Extensions_Selenium2TestCase_ScreenshotListener;

class ATest extends SeleniumTestCase
{
    function setUp()
    {
        parent::setUp();
        $this->setBrowser('phantomjs');
        $this->listener = new PHPUnit_Extensions_Selenium2TestCase_ScreenshotListener(
            base_path('tests/screenshots'));
    }

    function test()
    {
        $this->url('https://google.com');
        $this->assertContains('Equestrian', $this->title());
    }

    function onNotSuccessfulTest($e) {
        $this->listener->addError($this, $e, null);
        parent::onNotSuccessfulTest($e);
    }
}

SeleniumTestCase is written by me and extends PHPUnit_Extensions_Selenium2TestCase. It doesn't add anything in setUp or tearDown.

When I run it with Chrome (comment out setBrowser), I see:

enter image description here

But with PhantomJS I get (empty image):

enter image description here

x-yuri
  • 16,722
  • 15
  • 114
  • 161
  • http://stackoverflow.com/a/39315815/2781701 – Rafael Almeida Jan 16 '17 at 13:51
  • @RafaelAlmeida I see empty screenshot when I add `sleep(10)` before assertion. – x-yuri Jan 16 '17 at 14:32
  • Check the source code and see what is there – Rafael Almeida Jan 16 '17 at 14:33
  • @RafaelAlmeida What source code? Regarding my real test, that fails, I can't figure out why it fails with PhantomJS just by looking at test's source code. That's why I'm trying to learn how to make screenshots. With Chrome it succeeds. As for the `ATest`, the source is in the question. And it doesn't test any SUT, if anything. – x-yuri Jan 16 '17 at 14:56

0 Answers0