- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在执行 java 代码期间执行 driver.close();driver.quit();
时,会引发以下错误:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Tried to run command without establishing a connection Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:26.402Z' System info: host: 'ADMIN-PC', ip: '192.168.1.6', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_151' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{moz:profile=C:\Users\admin\AppData\Local\Temp\rust_mozprofile.ENTBvl2aDbSs, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, moz:headless=false, platform=XP, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=56.0.2, platformVersion=10.0, moz:processID=5004, browserName=firefox, javascriptEnabled=true, platformName=XP}] Session ID: 82e7dabd-c178-4d90-a3f8-84dc3f6ff14f at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:185) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:120) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:643) at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:482) at yahoo.main(yahoo.java:34)
分享抛出上述异常的代码:
//package basicSeleniumScripts;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class yahoo {
public static void main(String[] args) {
String Firefoxdriverpath = "C:\\Marionette\\geckodriver_1.exe";
WebDriver driver;
System.setProperty("webdriver.gecko.driver",Firefoxdriverpath);
//create a new instance of Firefox driver
driver = new FirefoxDriver();
//Open the page we want to open
driver.get("http://www.yahoo.com");
//Defining expected title
String expectedTitle = "Yahoo";
//Getting the actual title
String actualTitle = null;
actualTitle = driver.getTitle();
//Validating the TestCase
if (actualTitle.contentEquals(expectedTitle))
{
System.out.println("Test Passed");
}
else
{
System.out.println("Test Failed!!!");
}
driver.close();
driver.quit();
}
}
最佳答案
将 gecko 驱动程序版本更新到 v0.19.0,因为您使用的是 3.6.0 jars of selenium。
也仅使用退出方法
关于java - SeleniumError : org. openqa.selenium.SessionNotCreatedException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47185007/
我想在远程 Ubuntu 服务器上的 Chrome 上运行我的 WebDriver 测试用例。我已经在该服务器上安装了最新的 Chrome,但是当我使用这个时,我遇到了这些错误: System.set
我正在尝试将 OperaDriver 用于 selenium。 IWebDriver wd = new OperaDriver(); 但使用 OpenQA.Selenium.Opera;不存在。我在
我尝试在 selenium webdriver 中使用带注释 By 的页面对象进行自动化测试,但 Eclipse 显示以下消息错误: java.lang.ClassCastException: org
我正在尝试使用页面对象模型自动化 selenium Web 驱动程序中的单选按钮。下面是我的代码解释: By AutomaticDataLockTimed = By.xpath("//span[@cl
我正在尝试通过 Maven 运行我的用户接受测试用例 (JBehave),但收到此错误: Error:(10, 8) java: cannot access org.openqa.selenium.H
我正在使用 Spring Boot 2 和 Appium 从头开始创建一个新的测试框架。为了编写测试,我使用了 JUnit,它已经包含在 Spring Boot 的 spring-boot-sta
我有同样的 issue作为这篇文章的链接,我目前正在重新阅读 Selenium HQ 文档,重点是设置 PATH 环境。这是我要运行的代码。 using System; using OpenQA.Se
我正在使用: 火狐 56.0.1 Selenium 3.6.0 Windows 10 家庭版 壁虎驱动程序 0.19.0 错误信息是 The package org.openqa.selenium i
我正在尝试使用我正在使用的 Selenium 进行黑盒测试: Mac 操作系统:版本:10.9.4 java.版本:1.6.0_65 浏览器:firefox 版本 32.0.3 Selenium :版
public class Admin { public static void main(String args[]) throws MalformedURLException
我正在尝试使用 xsl 表导入登录凭据,例如:用户名 和 密码,使用下面的代码,但在运行时出现 NoSuchElementException 异常, 我的 xsl 表看起来像: username
System.setProperty(“webdriver.ie.driver”,“D:\Selenium\jars\IEDriverServer\IEDriverServer.exe”); WebD
运行 Selenium WebDriver 2.37.1 我在运行测试时遇到间歇性问题并收到以下错误: org.openqa.selenium.NoSuchElementException: no s
在执行 java 代码期间执行 driver.close();driver.quit(); 时,会引发以下错误: Exception in thread "main" org.openqa.selen
我正在尝试导入一个类,但 Eclipse 无法识别下载的库。我尝试通过Maven->更新项目来更新我的Maven项目,但没有帮助。我尝试删除除 selenium-java 之外的所有依赖项,但在 Ma
我在 UI 测试期间遇到以下错误。 org.openqa.selenium.WebDriverException: Element not found or not visible for xpath
我正在运行适用于 Android 应用程序的 appium 脚本。 但它根本没有运行。 我已经在我的 Maven 项目中添加了运行测试所需的所有依赖项。 添加下面的所有代码。 请检查并帮助我。 启动类
我正在编写一个自动化测试,如果出现错误,我想直接在 GitHub 的存储库中报告。在我的程序中失败的步骤是来自 GitHub Issue Tracker 的 Submit new issue 按钮。
openqa.selenium 和 thoughtworks.selenium 有什么区别?它们如何相互兼容? openqa.selenium包中没有Selenium类,但有WebDriver类。我想
必须在文本框中输入文本,列表会自动扩展,我需要选择第一项。但由于异常而失败; OpenQA.Selenium.NoSuchElementException。我尝试使用 wait.Until(),但遇到
我是一名优秀的程序员,十分优秀!