【Selenium】idea的selenium环境配置
http://www.jetbrains.com/idea/下载地址
1.maven配置
下载地址:http://maven.apache.org/download.cgi#
下载内容:apache-maven-3.5.0-bin.zip
环境变量:M2_HOME:E:\Java\apache-maven-3.5.0
path:%M2_HOME%\bin;
验证:mvn --version
2.settings.xml文件
分别拷贝到以下路径:
path\to\apache-maven-3.3.3\conf
<localRepository>E:\\Java\\LocalWarehoese</localRepository><url>http://maven.aliyun.com/nexus/content/groups/public/</url>使用阿里云提供的Maven镜像服务器。阿里云镜像服务器URL:
3下载IEDriverServer、chromedriver等使用到的driver,Firefox浏览器不需要另外下载driver。
4在C盘新建一个目录Selenium, 将下载下来的driver文件放到C:\Selenium
5新建Maven项目new Project→Maven→指定maven、
setting路径:ctrl+alt+s→mavenu user settings file :apache-maven-3.3.3\conf
本地仓库路径:E:\Java\LocalWarehoese(后面两个勾都勾上,目录才会生效)
GroupId、ArtifactId 随便填Settings→Maven
6pom.xml
http://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/3.4.0
复制Maven里面的内容,复制到pom.xml,<dependencies>里
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-ie-driver</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>2.47.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
7View→Tool Windows→Maven Project→刷新
不报红
8chromedriver.exe放到resources下面
9新建test文件夹
导入点击File->Project structure在左边点击Modules在右边电击test
文件夹点击Test Sources, test 文件夹变成绿色
10加入jar包
java-client-3.1.0.jar
selenium-server-standalone-2.49.0.jar放在test下
12简单启动Chromepublic class
public class demo1 {
public static void main(String[] args){
System.out.println("start firefox browser...");
System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver.exe");//指定驱动路径
WebDriver driver = new ChromeDriver();
driver.get("http://www.baidu.com/");
System.out.println("start firefox browser succeed...");
}
}
13安装JUnitGenerator V2.0
通过网络安装:Setting→Plugins→Browse repositories→查找JUnitGenerator V2.0→Install
手动下载安装:插件下载:https://plugins.jetbrains.com/idea/plugin/3064-junitgenerator-v2-0
Setting→Plugins→Install plugin from disk→d:\java\JUnitGenerator V2.0→ok
重新启动idea
(1)修改JUnitGenerator V2.0的配置。
1、自动生成测试代码和java类在同一包下,不匹配maven项目标准测试目录Other setting。
修改Output Path为:${SOURCEPATH}/../../test/java/${PACKAGE}/${FILENAME},
Default Template选择JUnit 4。
Setting→Plugins→Properties
2、修改测试用例模板。模板中生成的package的包名需去掉test。
Setting→Plugins→Other Setting →JUnitGenerator→JUnit4
package test.$entry.packageName;→$entry.packageName;
(2)、生成JUnit4测试用例。
方法一:在待编写测试的java类源码块上按快捷键Alt + Insert。选择JUnit Test->JUnit 4。
方法二、在待编写测试的java类源码块上按快捷键Ctrl + Shift + T。
方法三:光标定位到待编写测试的java类源码块,选择code->Generate,后面的步骤和方法1一样。
(3)、注意。
IDEA自带的JUnit插件和JUnitGeneratorV2.0插件都要勾选上,若只勾选JUnit可能导致无法自动生成测试文件,
若只勾选JUnitGenerator V2.0可能导致生成的测试文件无法运行
14、git配置
安装git,配置环境:bin
idea在setting配置git
15、NodeJS
下载nodejs→node -v→默认安装好了IDEA,在IDEA的file -> setting ->Plugins,右边默认是没有这个组件的需要你手动点击Browe repositories..,在插件列表中搜索node,将看到Node插件,点击下载
安装完成后必须重启→右上开启服务按钮→http://localhost:3000/
【Selenium】idea的selenium环境配置的更多相关文章
- Python+selenium+webdriver 安装与环境配置
1.python安装:访问python.org/download,下载最新版本,安装过程与其他windows软件类似.记得下载后设置path环境变量,然后Windows命令行就可以调用: 2.Sele ...
- Windows上python + selenium + Firefox浏览器的环境配置
1.python安装 我的电脑是32位的,安装了Python 3.5.4版本其它安装版本 2.python环境变量配置 将”C:\Program Files\Python35",”C:\Pr ...
- python+selenium的环境配置
以前写过关于python和selenium加myeclipse的环境配置,但是myeclipse启动时过于费时,虽然myeclipse有很好的提示功能,但是作为初学者,我还是直接用python的idl ...
- python+selenium环境配置及浏览器调用
最近在学习python自动化,从项目角度和技术基础角度出发,我选择了python+selenium+appium的模式开始我的自动化测试之旅: 一.python安装 二.python IDE使用简介 ...
- Maven 配置 Selenium + testNG + reportNG 运行环境
.markdown-preview:not([data-use-github-style]) { padding: 2em; font-size: 1.2em; color: rgb(56, 58, ...
- Selenium+Python的环境配置
因为项目的原因,最近较多的使用了UFT来进行自动化测试工作,半年没有使用Selenium了,于是在自己的电脑上重新配置了基于python3.x的selenium环境,配置过程大致如下: 1. Sele ...
- 转 Selenium+Python+Eclipse网页自动化集成环境配置(附简单的测试程序)
1 JDK.Python环境变量配置 下载JDK http://www.oracle.com/technetwork/java/javase/downloads/index.html,直接双击安装, ...
- Selenium+Python+Eclipse网页自动化集成环境配置(附简单的测试程序)
最近公司在给我们培训,主要是网页自动化测试的,现在的工作每天都是测APP,刚刚入门,不过,当我看了别人写的bug之后,就觉得不会觉得能够发现bug多么多么的厉害了. 前两周的时间一直在搭建自动化测试的 ...
- 数据抓取的艺术(一):Selenium+Phantomjs数据抓取环境配置
数据抓取的艺术(一):Selenium+Phantomjs数据抓取环境配置 2013-05-15 15:08:14 分类: Python/Ruby 数据抓取是一门艺术,和其他软件不同,世界上 ...
- C# selenium环境配置
1.下载C#selenium selenium官网: http://www.seleniumhq.org/download/ 下载后解压: 打开net35后,将里面的dll文件添 ...
随机推荐
- CF #284 div1 D. Traffic Jams in the Land 线段树
大意是有n段路,每一段路有个值a,通过每一端路需要1s,如果通过这一段路时刻t为a的倍数,则需要等待1s再走,也就是需要2s通过. 比较头疼的就是相邻两个数之间会因为数字不同制约,一开始想a的范围是2 ...
- Elasticsearch - 快速入门
Elasticsearch是基于Apache 2.0开源的实时.分布式.分析搜索引擎,相比Lucene,Elasticsearch的上手比较容易,这篇文章主要纪录Elasticsearch的基本概念和 ...
- 集合框架Map、List、Set
map分为:HashMap,TreeMap,LinkedHashMap,WeakHashMap和IdentityHashMap. 在实际开发的过程中,最常用的是HashMap,下面介绍一下最常见的用法 ...
- JS模式--装饰者模式(用AOP动态改变函数的参数)
Function.prototype.before = function (beforefn) { var _self = this; return function () { beforefn.ap ...
- js中的事件委托详解
概述: 那什么叫事件委托呢?它还有一个名字叫事件代理,JavaScript高级程序设计上讲:事件委托就是利用事件冒泡,只指定一个事件处理程序,就可以管理某一类型的所有事件.那这是什么意思呢?网上的各位 ...
- 【解决问题】解决python安装模块时UnicodeDecodeError
安装模块时,出现报错: UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 68: ordinal not in ...
- 进程间通信系列 之 消息队列函数(msgget、msgctl、msgsnd、msgrcv)及其范例
进程间通信系列 之 概述与对比 http://blog.csdn.net/younger_china/article/details/15808685 进程间通信系列 之 共享内存及其实例 ...
- oracle 创建用户并赋权 清空用户表
create user BUSM identified by BUSM; grant connect,resource,dba to BUSM; grant select any table to B ...
- ionic创建项目遇到的各种问题
前提:执行创建语句的前提是ionic环境已经装好,开始执行ionic start myApp blank. 提示已经有同名项目,是否覆盖.这里创建的是一个blank(空) 的ionic项目.还要两种是 ...
- ShadowBroker释放的NSA工具中Esteemaudit漏洞复现过程
没有时间测试呢,朋友们都成功复现,放上网盘地址:https://github.com/x0rz/EQGRP 近日臭名昭著的方程式组织工具包再次被公开,TheShadowBrokers在steemit. ...