简体   繁体   中英

Trying to test a web application using selenium webdriver, a error that pops showing not abe to connect to the local host

i am running the project file on the same system on which i am testing i am using selenium web driver and eclipse for testing the project but error is shown, when i run the selenium script for testing login page.

**error** :

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
    l,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{"32":"icon.png","48":"icon.png"},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},
"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1462864767739,"updateDate":1462864767739,"applyBackgroundUpdates":1,"skinnable":true,"size":22012,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"
{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"46.0.1","maxVersion":"46.0.1"}],"targetPlatforms":[],"seen":true}

so after this i had set the proxy 
and tried but the result was same 
but when i tried to copy the link and manually pasted it in Mozilla and searched it was successfully showing the login page

CODE SELENIUM

Package TESTING

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class demo {

    `public static void main(String[] args) {
        WebDriver driver= new Firefox Driver();
        driver.get("localhost:8080/Chaitanya");
        driver.findElement(By.name("username")).send Keys("login");
        driver.findElement(By.name("login.password")).send Keys("password");
     `   

There few typo error....

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class demo {

    public static void main(String[] args) {
        WebDriver driver= new FirefoxDriver();
        driver.get("http://localhost:8080/Chaitanya");
        driver.findElement(By.name("username")).sendKeys("login");
        driver.findElement(By.name("login.password")).sendKeys("password");
}

if Still same error occurs. Please update Selenium Jar to latest( http://www.seleniumhq.org/download/ ), and update Firefox browser to latest version.

I had same issue in my recent project (FYI: issue is caused by port) , fixes for this is:

Try to update latest version of selenium, this should fix it. if not, dirty work around for this is

    WebDriver driver;     
    try {
    driver = new FirefoxDriver();
    }
    catch(Exception e) {
    driver = new FirefoxDriver();
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM