-1

I have a Selenium, TestNG and maven application.

If I run mvn intergration-test the Firefox browser opens but URL not working.

Also getting the below error in the console

Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055

my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.selenium</groupId>
<artifactId>Selenium</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Selenium</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.selenium>2.53.1</version.selenium>
    <version.testng>6.9.10</version.testng>
    <version.maven.compiler.plugin>2.3.2</version.maven.compiler.plugin>
    <version.java.source>1.8</version.java.source>
    <version.java.target>1.8</version.java.target>
</properties>

<dependencies>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${version.testng}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <!-- <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server-standalone</artifactId> 
            <version>${version.selenium}</version> <scope>test</scope>  -->
         <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.1</version> 
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${version.maven.compiler.plugin}</version>
            <configuration>
                <source>${version.java.source}</source>
                <target>${version.java.target}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <argLine>-Xms128m -Xmx256m -XX:PermSize=128m -XX:MaxPermSize=256m</argLine>
                <parallel>true</parallel>
                <suiteXmlFiles>
                    <suiteXmlFile>src/main/java/com/selenium/testng.xml</suiteXmlFile>
                </suiteXmlFiles>
                <!-- Skip the normal tests, we'll run them in the integration-test phase -->
                <skip>true</skip>
            </configuration>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <skip>false</skip>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Gnik
  • 7,120
  • 20
  • 79
  • 129
  • What version is your firefox? – Moe Ghafari Jan 11 '18 at 16:56
  • Any time the browser launches but does not browse to the URL, you should update your drivers and browser or at least make sure that the versions match. – JeffC Jan 11 '18 at 17:30
  • @Moe: Using Firefox 57.0.4. – Gnik Jan 12 '18 at 14:26
  • @JeffC: 1. How can I update my driver? 2. How can i check the version matches. I mean where can i check which FF version will work for this particular Selenium version? – Gnik Jan 12 '18 at 14:28
  • 1
    Go to the [Selenium download site](http://www.seleniumhq.org/download/) and get the current Selenium driver under "Selenium Client & WebDriver Language Bindings" for your language (Java). Then scroll down to the "Third Party Drivers, Bindings, and Plugins" section and get the Mozilla GeckoDriver (FF driver). Unzip and drop those into your project and you should be good. You will want to launch FF and make sure it is up to date. Once you do all that, you should be good. If not, you will at least have eliminated a common source of issues with mismatched/old versions. – JeffC Jan 12 '18 at 14:41

1 Answers1

1

I usually see such behavior when the browser version is not compatible with your driver version, from you pom i see you are using selenium ver 2.25, this is a bit old and i think only supports FF 14. Please verify that you are using the correct version of firefox. if you need help installing an older version of firefox see this:

https://support.mozilla.org/en-US/kb/install-older-version-of-firefox

Moe Ghafari
  • 2,227
  • 1
  • 12
  • 17