no display specified error with Selenium test
Install xvnc,
Then start it by simply typing
vncserver
this will be followed by the terminal asking to enter a passphrase, and a display number will be returned.
Export that Display number to enable selenium to launch the firefox browser on that virtual display.
You can export like so
export DISPLAY=:1 # Assuming 1 is the display number returned.
Using the above steps will hopefully give you more meaning to what/why you are exporting/displaying. While, the reason to export is to provide a virtual display so that firefox launches "normally", and selenium can use native interactions to interact with it.
Can you re-phrase your a qs a bit with more specifications like which OS are you using , which selenium jar are you using which N-unit framework are you taking for writing test cases and which Programmibg language are you using for writing test cases ?
I also faced the same problem and it was resolved by taking these steps :1. I had old selemium-server-standalone-jar I updated it to latest 2.402. I had old FF version I tool FF 29 .And I used junit for test cases designing and it worked for me.
Please let me know if it makes sense to you as I am using Windows machine.And the issue was:
xception: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:ser\\AppData\\Local\\Temp\\anonymous6184290163469300810webdriver-profile\\extensions\\fxdriver@googlecode.com","mtime":1401260795981,"rdfTime":1401260791866}}}]*** LOG addons.xpi-utils: Opening XPI database C:\Users\user\AppData\Local\Temp\anonymous6184290163469300810webdriver-profile\extensions.json*** LOG addons.xpi: New add-on fxdriver@googlecode.com installed in app-profile*** Blocklist::_loadBlocklistFromFile: blocklist is disabled*** LOG addons.xpi-utils: Make addon app-profile:fxdriver@googlecode.com visible*** LOG DeferredSave/extensions.json: Save changes*** LOG DeferredSave/extensions.json: Save changes*** LOG addons.xpi: New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global*** LOG addons.xpi-utils: Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible*** LOG DeferredSave/extensions.json: Save changes*** LOG DeferredSave/extensions.json: Save changes*** LOG addons.xpi: New add-on otis@digitalpersona.com installed in winreg-app-global*** LOG addons.xpi-utils: Make addon winreg-app-global:otis@digitalpersona.com visible*** LOG DeferredSave/extensions.json: Save changes*** LOG DeferredSave/extensions.json: Save changes*** LOG addons.xpi: New add-on ext@VideoPlayerV3beta652.net installed in winreg-app-global*** LOG addons.xpi-utils: Make addon winreg-app-global:ext@VideoPlayerV3beta652.net visible*** LOG DeferredSave/extensions.json: Save changes*** LOG DeferredSave/extensions.json: Save changes*** LOG addons.xpi: New add-on ext@MediaPlayerV1alpha512.net installed in winreg-app-global*** LOG addons.xpi-utils: Make addon winreg-app-global:ext@MediaPlayerV1alpha512.net visible*** LOG DeferredSave/extensions.json: Save changes*** LOG DeferredSave/extensions.json: Save changes*** LOG addons.xpi: New add-on {55A8EC97-6AF6-442c-877F-11C51DBD162D} installed in winreg-app-global*** LOG addons.xpi-utils: Make addon winreg-app-global:{55A8EC97-6AF6-442c-877F-11C51DBD162D} visible*** LOG DeferredSave/extensions.json: Save changes*** LOG DeferredSave/extensions.json: Save changes*** LOG addons.xpi: Updating database with changes to installed add-ons*** LOG addons.xpi-utils: Updating add-on states*** LOG addons.xpi-utils: Writing add-ons list*** LOG DeferredSave/extensions.json: Starting timer*** LOG DeferredSave/extensions.json: Starting write*** LOG DeferredSave/extensions.json: Write succeeded*** LOG addons.xpi-utils: XPI Database saved, setting schema version preference to 16*** LOG addons.manager: shutdown*** LOG addons.xpi: shutdown*** LOG addons.xpi-utils: shutdown*** LOG addons.xpi: Notifying XPI shutdown observers*** LOG addons.manager: Async provider shutdown doneSystem JS : ERROR resource://gre/modules/BookmarkHTMLUtils.jsm:798 - NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsINavBookmarksService.removeFolderChildren]System JS : ERROR resource://app/components/nsBrowserGlue.js:1713 - NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIAnnotationService.getItemsWithAnnotation]System JS : ERROR resource://gre/modules/BookmarkHTMLUtils.jsm:835 - NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsINavBookmarksService.runInBatchMode]*** LOG addons.xpi: startup*** LOG addons.xpi: Skipping unavailable install location app-system-local*** LOG addons.xpi: Skipping unavailable install location app-system-share*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: C:\Users\user\AppData\Local\Temp\anonymous6184290163469300810webdriver-profile\extensions\webdriver-staging*** LOG addons.xpi: checkForChanges*** LOG addons.xpi: No changes found*** Blocklist::_loadBlocklistFromFile: blocklist is disabledJavaScript error: chrome://browser/content/urlbarBindings.xml, line 650: aUrl is undefined*** LOG addons.manager: shutdown*** LOG addons.xpi: shutdown*** LOG addons.xpi: Notifying XPI shutdown observers*** LOG addons.manager: Async provider shutdown done at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:106) at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)