解决selemium报错 Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure

关于 Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

代码中少了 webdriver.chrome.driver", "C:/selemiumlib/chromedriver.exe

应该为这样

        System.setProperty("webdriver.chrome.driver", "C:/selemiumlib/chromedriver.exe");
    //System.setProperty("webdriver.chrome.bin","C:/Program Files (x86)/Google/Chrome/Application/chrome.exe");
        System.setProperty("webdriver.chrome.bin","C:/Users/Admin/AppData/Local/Google/Chrome/Application/chrome.exe");
    WebDriver driver = new ChromeDriver();
    driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
    driver.get("http://www.baidu.com");
    driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
    driver.close();
 System.setProperty("webdriver.chrome.driver", "C:/selemiumlib/chromedriver.exe");

不添加这一行其实也可以,但要注意系统中chrome应该只有一个,否则报错

正在研究一个系统里有不同版本的chrome的调用方法

 
时间: 2024-12-25 22:27:45

解决selemium报错 Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure的相关文章

git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).

Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists). 解决办法一:保留本地的更改,中止合并->重新合并->重新拉取 $:git merge --abort $:git reset --merge $:git pull 解决办法二:舍弃本地代码,远端版本覆盖本地版本(慎重) $:git fetch --all $:git reset --hard origin/ma

解决tomcat报错javax.imageio.IIOException: Can't create output stream!

启动tomcat catalina.out报错如下,登陆的时候无法显示验证码 2017-06-09 11:23:06,628 DEBUG org.springframework.web.servlet.DispatcherServlet 845 - DispatcherServlet with name 'spring-mvc' processing GET request for [/data-analysis/kaptchaImage.do]2017-06-09 11:23:06,629 D

系统调优:如何解决系统报错too many open files瓶颈

一.检查系统版本是否手工升级 [[email protected] ~]# uname -r   linux的内核版本号 2.6.32-358.el6.x86_64 [[email protected] ~]# cat /proc/version Linux version 2.6.32-358.el6.x86_64  [[email protected] ~]# cat /etc/issue  系统安装时默认的发行版本 CentOS release 6.4 (Final) [[email pr

解决mysql报错:- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ'

mysql执行报错: - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_fu

解决yum报错:UnicodeDecodeError: 'ascii' codec can't decode ... ordinal not in range

在使用yum部署环境的时候,出现了报错: UnicodeDecodeError: 'ascii' codec can't decode ... ordinal not in range 解决办法: [[email protected] ~]# ll /var/lib/rpm/*db*-rw-r--r-- 1 root root 73728 Aug 15 14:52 /var/lib/rpm/__db.001-rw-r--r-- 1 root root 270336 Aug 15 14:52 /v

解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).

Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists). 2017年02月22日 20:38:28 阅读数:19178 Git fetch和git pull的区别: 都可以从远程获取最新版本到本地 1.Git fetch:只是从远程获取最新版本到本地,不会merge(合并) $:git fetch origin master //从远程的origin的master主分支

解决 sqlalchemy 报错:(1193, "Unknown system variable 'tx_isolation'")

1出现此报错的原因是使用的mysql8.0 以前用的是:tx_isolation 现在用是: transaction_isolation a.通过升级 sqlalchemy 的方法可以解决此问题, pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade sqlalchemy --ignore-installed(亲测有效————) b.通过降低,mysql 版本来解决这个问题. 解决 sqlalchemy 报错:(119

解决MySql报错:1130 - Host 'xxx' is not allowed to connect to this MySQL server的方法

发现问题 使用Navicat连接MySql数据库时,未能成功,提示信息如下图: 这个错误提示已经很明确了,"不允许主机'desktop-teat9ob'连接到此mysql服务器",知道问题所在就好解决了. 解决办法 我们远程联接到MySql服务器,打开服务器本地Navicat软件,在查询编辑器中执行下面的SQL语句 #查询允许连接的主机及用户信息 select Host,User,Password from mysql.user; 结果如下图: 从结果中可以看到,MySql只允许使用r

解决IE报错:Locale 'chinese' is not well-formed,或RangeError: 区域设置“chinese”的格式不正确的问题

接之前的此博客问题处理:js处理时间时区问题 由于 toLocaleString():据本地时间格式,把 Date 对象转换为字符串.总是会带有上午/下午,所以我加了参数:new Date('2019-09-12 23:33:33').toLocaleString('chinese', {hour12: false}),这样返回的字符串就是24小时制,而没有上午下午. 但是,在IE浏览器下就会报标题的错误,期初不知道是什么原因,经过排查发现就是这个参数问题. 所以我们需要修改下:可以利用 toU