Selenium unable to connect to ChromeDriver 75 on Mac - java

We are upgrading a previously-working Selenium/Java/Chrome test configuration, to newer versions:
ChromeDriver 2.35 -> 75.0.3770.90
Selenium Java 3.14 -> 3.141.59
macOS 10.14.5 (unchanged)
Java 11.0.3 (unchanged)
Chrome 75.0.3770.100 (unchanged)
However, when attempting to run a Selenium test, we see:
java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:28719
The full stack/log:
Starting ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770#{#1003}) on port 28719
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Jun 26, 2019 10:45:03 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
...
org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:28719
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Craigs-iMac.local', ip: '192.168.1.131', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '11.0.3'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByTagName(RemoteWebDriver.java:396)
at org.openqa.selenium.By$ByTagName.findElement(By.java:320)
All the resources I've found in this area suggest using --whitelisted-ips='', which did not have an effect, or were related to incompatible Selenium/Chrome/ChromeDriver versions, which I don't think is the issue here.
Update: I can confirm that the driver starts, and is listening on port 28719, but then stops at some point between startup and execution of the actual test. I've found no errors/logging related to the shutdown.
Update 2: I've debugged, and the initial commands sent to the remote driver succeed (setWindowSize()), but this line causes the driver to die silently:
((WebStorage) driver).getLocalStorage().setItem("token", token);

It seems newer versions of the ChromeDriver (Or Selenium? I don't know.) launch Chrome with an initial page sitting at the URL data:.
By adding these system properties prior to instantiating the ChromeDriver:
System.setProperty("webdriver.chrome.logfile", "/Users/craig/chromedriver.log");
System.setProperty("webdriver.chrome.verboseLogging", "true");
I was able to glean the following right before the driver quits:
[1561563455.971][INFO]: [01517094c63c0dd609c06a5622afe6b1] RESPONSE ExecuteScript ERROR <unknown>: Failed to read the 'localStorage' property from 'Window': Storage is disabled inside 'data:' URLs.
(Session info: headless chrome=75.0.3770.100)
So by changing this call in my test utility code:
((WebStorage) driver).getLocalStorage().setItem("token", token);
To this:
if (driver.getCurrentUrl().startsWith("data:")) {
// Driver will quit if we try to access localStorage without a page load
driver.get("/");
}
((WebStorage) driver).getLocalStorage().setItem("token", token);
Everything is now fine. https://i.imgur.com/edBQBeJ.gif

Editing:
LocalStorage is available only after launching any website. ie after driver.get
https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/html5/LocalStorage.html

Related

How to run selenium tests on chrome if only binary file of chrome is placed in a server location in E drive

I have a situation in my project as below :
My code was executing as expected till the IT admin uninstalled chrome and FF from Jenkins server.
After raising a concern they placed a chrome binary in E drive .( E:\GC Local\GoogleChrome).But Chrome is not installed anywhere
I am facing issues to resolve this.
Do anyone guide here ?
Code I used :
if ("chrome".equals(browser))
{
System.setProperty("webdriver.chrome.driver",
System.getProperty("user.dir")
+ "\\src\\test\\resources\\drivers\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
options.addArguments("--start-maximized");
driver = new ChromeDriver(options);
}
Will it work for you ?
ChromeOptions options = new ChromeOptions();
options.setBinary("E:\\GC Local\\GoogleChrome");
I understand that in homepath \app data chrome should be installed by default to run chrome tests. In my case , there is no chrome istalled in homepath-app but in E drive
When I used the below code :
ChromeOptions options = new ChromeOptions();
options.setBinary("E:\\GCLocal\\GoogleChrome\\GoogleChromePortable.exe");
// System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\Browsers\\chromedriver.exe");
System.setProperty("webdriver.chrome.driver",
System.getProperty("user.dir")
+ "\\src\\test\\resources\\drivers\\chromedriver.exe");
driver = new ChromeDriver(options);
I am getting getting the following :
T E S T S
Running TestSuite
Browser :chrome
Starting ChromeDriver 2.29.461591 (62ebf098771772160f391d75e589dc567915b233) on port 45594
Only local connections are allowed.
Error in initializing the Test .Details :-
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally
(Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 62.74 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'WHIS2002', ip: '10.192.129.112', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77'
Driver info: org.openqa.selenium.chrome.ChromeDriver
./TestReport.html
The above approach is correct. My issue was that portable-chrome binary refused to open due to some issues in server .code was fine.
This happened because of portable chrome binary performance issues which I solved like this :
Google Chrome Portable may run slowly from some flash drives. You can speed this up by copying GoogleChromePortable.ini from the GoogleChromePortable\Other\Source directory to the GoogleChromePortable directory and editing it to set RunLocally=true. If you do so, be sure to allow Google Chrome Portable time to copy your profile back after shutting it down. Of course, there are privacy implications to copying your personal data locally to a PC not under your control.
Thanks

Selenium webdriver error..It is unable to send keys with selenium webdriver

I am using Selenium Webdriver. I have searched many times and tried every answer in order to successfully testing a case. I am new to test automation.
Problem: There is an error when I use .sendKeys() and also click on some web element. I am really upset about this. I want to go forward with testing. Please help me solve this.
And also it displays an error stating InvalidValueError: initMap is not a function. Previously I have ran this codes successfully.
My setup is a follows:
Firefox 53.0
Eclipse Juno 32bit
Selenium Wevdriver 3.3.1
GeckoDriver 16.0
logger apache-log4j-1.2.17
This is the error:
1495778288530 geckodriver INFO Listening on 127.0.0.1:23817
1495778289152 mozprofile::profile INFO Using profile path
C:\Users\EXTROG~1\AppData\Local\Temp\rust_mozprofile.pTb73U1lR7sv
1495778289154 geckodriver::marionette INFO Starting browser C:\Program
Files\Mozilla Firefox\firefox.exe with args []
1495778289159 geckodriver::marionette INFO Connecting to Marionette on
localhost:50245 1495778293537 Marionette INFO Listening on port 50245
May 26, 2017 11:28:13 AM org.openqa.selenium.remote.ProtocolHandshake
createSession INFO: Detected dialect: W3C JavaScript error: , line 0:
uncaught exception: InvalidValueError: initMap is not a function INFO
[main] (SearchBarTest.java:20)- search bar is there Error : Expected
[object Undefined] undefined to be a string Build info: version:
'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'EXTROGENE-PC', ip: '192.168.1.18', os.name:
'Windows 7', os.arch: 'x86', os.version: '6.1', java.version:
'1.8.0_121' Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities
[{moz:profile=C:\Users\EXTROG~1\AppData\Local\Temp\rust_mozprofile.pTb73U1lR7sv,
rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000},
pageLoadStrategy=normal, platform=ANY, specificationLevel=0,
moz:accessibilityChecks=false, acceptInsecureCerts=false,
browserVersion=53.0.3, platformVersion=6.1, moz:processID=1896,
browserName=firefox, platformName=windows_nt}] Session ID:
0d78f916-fa2e-4325-8baf-08b8e444d250
This is my code:
WebElement element=driver.findElement(By.xpath("//*[#id='serchkey']"));
driver.findElement(By.xpath("//*[#id='serchkey']")).sendKeys(new String("toy"));
Try this it may work:
WebElement element =driver.findElement(By.id("serchkey"));
javascriptSendKeys(element,"toy");
private void javascriptSendKeys(WebElement yourElement, String yourText){
JavascriptExecutor executor = (JavascriptExecutor)webDriver;
executor.executorScript("arguments[0].value='" + yourText + "';", yourElement);
}
Here is the Answer to your Question:
Great job done by specifying the Test Environment details as:
Selenium Webdriver 3.3.1
GeckoDriver 16.0
Now, if you have a look at the documentation of geckodriver v0.16.0 here, you will find a Heading as: "Note that geckodriver v0.16.0 is only compatible with Selenium 3.4 and greater."
So the solution to your Question is to upgrade your Selenium to 3.4.0 from here.
Let me know if this Answers your Question.

Chromedriver failing on Jenkins (Linux)

I am trying to run UI tests on Chrome on Jenkins, and from the error it appears that it is failing to start.
org.openqa.selenium.WebDriverException: chrome not reachable
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 2.6.32-358.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.54 seconds (user: 'UnknownUser-0', output: '1440016601647')
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'abc.xyz.com', ip: '111.222.333.444', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-358.el6.x86_64', java.version: '1.8.0_05'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)...
The code (in Java) simply tries to instantiate a default instance of Chromedriver, and fails. The following message also shows in the log, which confuses me. It appears that the driver is opening, but stopping immediately?
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 4601
Only local connections are allowed.
[0.422][WARNING]: PAC support disabled because there is no system implementation
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 9515
Only local connections are allowed.
The instantiation is done as:
WebDriver webDriver = null;
String chromeDriverLocation = MyCustomPropertyReader.getProperty("webdriver.chrome.binary.location");
System.setProperty("webdriver.chrome.driver", chromeDriverLocation);
final DesiredCapabilities capabilities = DesiredCapabilities.chrome();
webDriver = new ChromeDriver(capabilities);
I am able to run the Chromedriver from the command prompt, and I have also checked that all the environment variables that are needed to load it up and indeed available during the instantiation.
Could someone tell me what I might be missing, or if there is a way to obtain more information about the cause of this failure?
The issue was resolved by updating the browser installation, and making sure that both Chromedriver and the Chrome browser can be run from the command prompt.

Selenium UnreachableBrowserException - "Could not start a new session" in SoapUI Groovy TestStep

I use SoapUI Pro 5.1.2 on Win7 x32, and try to connect to Selenium Webdriver in Groovy TestStep.
For this purpose I added selenium-standalone-server.jar v2.45.0 in $SOAP_HOME$\bin\ext folder.
My Groovy TestStep code:
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
System.setProperty('webdriver.chrome.driver', 'C:\\\\Windows\\system32\\chromedriver.exe')
log.info(System.getProperty('webdriver.chrome.driver')) //got 'C:\\Windows\system32\chromedriver.exe'
WebDriver driver = new ChromeDriver() // this line causes error
driver.get('http://google.com')
driver.quit()
When I try to run this step, SoapUI returns message:
org.openqa.selenium.remote.UnreachableBrowserException:
Could not start a new session.
Possible causes are invalid address of the remote server or browser start-up failure.
Build info:
version: '2.45.0',
revision: '5017cb8',
time: '2015-02-26 23:59:50'
System info:
host: 'SmithPC',
ip: '10.0.2.15',
os.name: 'Windows 7',
os.arch: 'x86',
os.version: '6.1',
java.version: '1.8.0_45'
Driver info:
driver.version: ChromeDriver
error at line: 7
I tried to run this piece of code through the Netbeans IDE, after adding the same selenium-standalone-server.jar package to empty java project. And it has completed without problems!
This is error-log of soapUI:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'SmithPC', ip: '10.0.2.15', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:160)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)
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:422)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
at Script3.run(Script3.groovy:7)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:79)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:138)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250)
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: java.lang.NullPointerException
at org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:79)
at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:77)
at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:183)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:126)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:72)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:133)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:66)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
... 23 more
I also tried use FirefoxDriver() instead of ChromeDriver(), and got the same error.
I have encountered the same error, which said:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
but chromedriver.exe started fine. I can see it in task manager.
My environment is as following,
windows 7, ultimate, 64 bit system
selenium-server-standalone-2.47.1
chromedriver 2.19
google chrome: 45.0
After many tries suggested in google results, my final solution is to add 127.0.0.1 localhost to C:\Windows\System32\drivers\etc\hosts.
Hope to help you!
Download latest driver(chrome or IE) from seleniumhq.org, and use below code
System.setProperty("webdriver.chrome.driver","<YourPath>chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://www.yahoo.com");
This worked for me.
In selenium this error message:
org.openqa.selenium.remote.UnreachableBrowserException: Could not
start a new session. Possible causes are invalid address of the remote
server or browser start-up failure.
Could have a lot of causes. However looking at the stacktrace in this case is due to a NullPointerException:
Caused by: java.lang.NullPointerException
at org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:79)
at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:77)
at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124)
The problem is that you're using selenium inside SOAPUI. SOAPUI seems to set the default proxy to null (ProxySelector.setDefault(null)). So when selenium gets the default proxy an invoke a method on it, a NullPointerException is thrown.
The problem is that you executes your code inside SOAPUI so you can not get the default proxy before SOAPUI set it to null... then a possible workaround is in your Groovy testStep try to create a ProxySelector an set it as default before WebDriver is executed:
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import java.net.Proxy
import java.net.ProxySelector
def selectDirectProxy(URI uri) {
final List<Proxy> proxy = new ArrayList<Proxy>()
proxy.add(Proxy.NO_PROXY)
return proxy
}
// create a ProxySelector
ProxySelector proxySelector = [ select : { uri->selectDirectProxy(uri) } ] as ProxySelector
// set as default to avoid null pointer
ProxySelector.setDefault(proxySelector);
// now it's safe to invoke WebDriver...
System.setProperty('webdriver.chrome.driver', 'C:\\\\Windows\\system32\\chromedriver.exe')
log.info(System.getProperty('webdriver.chrome.driver')) //got 'C:\\Windows\system32\chromedriver.exe'
WebDriver driver = new ChromeDriver()
In this example I extend the ProxySelector abstract class in a groovy way, to set at least one direct proxy. If its necessary it's also possible to use the Proxy class to configure a no direct proxy and set it in the list, but with this code I'm trying to avoid the NPE due to SOAPUI ProxySelector.setDefault(null).
It already told you what happened:
//got 'C:**\\**Windows\system32\chromedriver.exe'
Try to define path using one of the next ways:
System.setProperty('webdriver.chrome.driver','C:\\Windows\\system32\\chromedriver.exe')
log.info(System.getProperty('webdriver.chrome.driver'))
OR
System.setProperty('webdriver.chrome.driver','C:/Windows/system32/chromedriver.exe')
log.info(System.getProperty('webdriver.chrome.driver'))
Also, I would not recommend you to store chromedriver.exe in system32 folder, especially if you don't have admin rights on the workstation. Use smt like C:/WebDrivers/hromedriver.exe
This could be a compatibility issue between the 'selenium', 'chrome browser version' and 'chrome driver' version that you are using.
It you are using Selenium 2.53 (like me), then using chrome driver 2.25 should work for you.
You can download it from here - https://chromedriver.storage.googleapis.com/index.html?path=2.25/
I encountered the same issue and upgrading to the latest chrome driver fixed my issue.
You can download the latest chrome driver from following URL.
http://chromedriver.storage.googleapis.com/index.html
It is best to use always the latest version. After downloading, set the path of chrome driver in System.setProperty("webdriver.chrome.driver","{Your path Chrome Driver}");
System.out.println("Creating Chrome Driver");
// Set Chrome Driver
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("{Your URL}");
This problem is totally related to the chrome browser version and chrome driver version.
Once you keep both browser and driver versions the same, your problem will get resolved.
To check the chrome version go to the following steps ->> Click on three vertical dots ->> Help ->> About Google Chrome Browser ->> see the chrome version.
Now check the chrome BROWSER version
in my case browser version is 90.0
Now download the same version of the chrome driver respective of the operating system
We will download the 90.0 version of driver, then set the browser path
System.setProperty("webdriver.chrome.driver", "D:\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("{Your URL}")
#JAVA #SELENIUM
If someone encountered a similar problem on Ubuntu, please check if you install Chromium web browser
Not enough to have only chrome browser.
More details

how to run codeception acceptance testing with selenium on remote server

I have a testing server for my phpunit, and now we want to add our codeception acceptance testing with selenium.
But as you the remote server has no "desktop" so it will not open a browser like in our developers computers.
I tried installing firefox on the machine but I still get this error:
Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'testdev', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version:
'3.2.0-23-generic', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
so now I did this
WebDriver:
url: 'http://example.com/'
browser: firefox
capabilities:
binary: "/usr/bin/firefox"
and I get this error:
Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
is it possible what I'm doing?
or I must have a "screen"?
In order to use Selenium with Firefox, or Chrome, etc - you need a linux distro that has a User Interface.
If you are on a linux machine that doesn't have a display (aka, just a terminal), then you can research Selenium HTMLUnit (headless browsing).
You could do headless browsing via the PHPBrowser, or you could install a GUI like xfce4 vnc4server, which will give you a virtual desktop to run Firefox in. This has the added bonus that you can watch the test run graphically.

Categories

Resources