使用selenium启动火狐浏览器,解决Unable to create new remote session问题
今天用火狐浏览器来做自动化,才启动就报错,提示不能创建新的session,不能启动浏览器

问题原因:
火狐driver与火狐浏览器与selenium版本的不兼容
我使用的火狐driver是0.21.0 版本,下载地址:https://github.com/mozilla/geckodriver/releases
使用的火狐浏览器版本是60,下载地址:http://www.firefox.com.cn/download/

使用selenium-java的版本是3.12.0,因为是使用的maven,maven配置为
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
</dependency>
调试的代码为
public class firefoxsrun {
WebDriver driver;
@BeforeClass
public void beforeClass(){
System.setProperty("webdriver.gecko.driver", "resources/geckodriver.exe");
driver = new FirefoxDriver();
driver.get("http://www.baidu.com");
}
@Test
public void test2(){
System.out.println("成功啦");
driver.findElement(By.id("kw")).sendKeys("testurl");
driver.findElement(By.id("su")).click();
}
}
我的diver就放在我的项目目录下的resource下

使用selenium启动火狐浏览器,解决Unable to create new remote session问题的更多相关文章
- java selenium启动火狐浏览器报错:Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:14.666Z
Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA Build in ...
- 7.解决在python中用selenium启动FireFox浏览器启动不了的方法
首次在利用python中的selenium启动FireFox浏览器时可能碰到如下问题 当输入如下代码时: from selenium import webdriver brower=webdriver ...
- selenium 启动ie 浏览器
selenium 启动ie 浏览器 var driver = new InternetExplorerDriver(@"IEDriverServer.exe路径"); driver ...
- Selenium 启动无头浏览器,只有chrome 和 firefox的,没有IE
使用无头浏览器,可以避免掉不确定的弹出框对脚本稳定性的影响,还能在脚本执行过程中省略掉了css 加载的时间. 以下是Selenium 启动无头浏览器的方法,只有chrome 和 firefox的. p ...
- 排错:Unable to create a new session key. It is likely that the cache is unavailable.
排错:Unable to create a new session key. It is likely that the cache is unavailable. 问题 登录openstack页面, ...
- Dashboard登录成功后 RuntimeError: Unable to create a new session key.
openstack按照官网docs部署horizon后,使用admin账号密码登录,但网页提示未知错误. 查看/var/log/httpd/error_log 提示这个:RuntimeError: U ...
- openstack中dashboard页面RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.
环境是centos7,直接跑在服务器上. 按照官网一步步安装openstack,到验证dashborad时出错. 登录http://192.168.1.73/dashboard ,输入域名,用户名,密 ...
- openstack RuntimeError: Unable to create a new session key. It is likely that the cache
[Mon Apr 15 01:02:31.654247 2019] [:error] [pid 19433:tid 139790082479872] Login successful for user ...
- python无法启动火狐浏览器且报错“selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities”
安装了python2,使用pip安装了selenium,但是在使用时,报了“selenium.common.exceptions.WebDriverException: Message: 'gecko ...
随机推荐
- connecting-to-github-with-ssh
https://help.github.com/articles/connecting-to-github-with-ssh/ 创建ssh密钥后,从github clone仓库到本地出现permiss ...
- android Activity启动过程(四)startActivityUncheckedLocked
final int startActivityUncheckedLocked(ActivityRecord r, ActivityRecord sourceRecord, IVoiceInteract ...
- LeetCode 110.平衡二叉树(C++)
给定一个二叉树,判断它是否是高度平衡的二叉树. 本题中,一棵高度平衡二叉树定义为: 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过1. 示例 1: 给定二叉树 [3,9,20,null,nu ...
- 工作空间造成的javaweb项目无法新建
出现问题: 当我打开myeclipse开发工具将原有的已经存在的一个名为jeecms的项目删除的时候,出现了删除不了,因此我采取了强制的删除的方法,最终项目删除了.接下来新建同名的javaweb就出现 ...
- Hibernate系列3-----之修改
只是修改测试类,先看其他的代码的同学,请翻看我的博客Hibernate1,嘿嘿,我就在这不在重写一遍来 @Test public void testhibernate() { updateStuden ...
- AFNetworking 3.0修改指南
AFNetworking是一款在OS X和iOS下都令人喜爱的网络库.为了迎合iOS新版本的升级, AFNetworking在3.0版本中删除了基于NSURLConnectionAPI的所有支持.如果 ...
- DO、PO、BO、DTO、VO等概念
PO 全称为:Persistant Object,持久化对象,与数据库结构映射的实体,数据库中的一条数据即为一个 PO 对象. BO 全称为:Business Object,业务对象,主要作用是把业务 ...
- 【踩坑】报错 non-static method xxx() cannot be referenced from a static context
今天测试代码时遇到 Error:(6, 55) java: non-static method sayGoodbye() cannot be referenced from a static cont ...
- NIM(1) 一排石头的游戏
最近在实习面试过程中,一个朋友遇到了该问题,从简单到复杂的思路如下,希望能给遇到相同问题的朋友一些启发和帮助.(内容来源网络和<编程之美>) 1.问题1 100个苹果 桌上有100个苹果, ...
- python面试题——数据库和缓存(46题)
1.列举常见的关系型数据库和非关系型都有那些? 2.MySQL常见数据库引擎及比较? 3.简述数据三大范式? 4.什么是事务?MySQL如何支持事务? 5.简述数据库设计中一对多和多对多的应用场景? ...