[英]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. 我在要测试的同一系统上运行项目文件,我正在使用selenium Web驱动程序和eclipse来测试项目,但是当我运行selenium脚本来测试登录页面时,会显示错误。
**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. 请将Selenium Jar更新到最新版本( http://www.seleniumhq.org/download/ ),并将Firefox浏览器更新到最新版本。
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();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.