【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文件添 ...
随机推荐
- FOJ 11月月赛题解
抽空在vjudge上做了这套题.剩下FZU 2208数论题不会. FZU 2205 这是个想法题,每次可以在上一次基础上加上边数/2的新边. #include <iostream> #in ...
- dotnetcore中的IOptionsSnapshot<>的自动更新原理
1.首先讲讲ChangeToken.OnChange方法: 原理是给一个CancellationToken注册一个消费者委托,调用CancellationToken的Cancel的时候会调用这个Can ...
- IOC容器的依赖注入
1.依赖注入发生的时间 当Spring IoC容器完成了Bean定义资源的定位.载入和解析注册以后,IoC容器中已经管理类Bean定义的相关数据,但是此时IoC容器还没有对所管理的Bean进行依赖注入 ...
- bzoj1487 [HNOI2009]无归岛
Description Neverland是个神奇的地方,它由一些岛屿环形排列组成,每个岛上都生活着之中与众不同的物种.但是这些物种都有一个共同的生活习性:对于同一个岛 上的任意两个生物,他们有且仅有 ...
- get和post提交数据的区别
get是客户端向服务器索取数据的请求,设定的初衷是,客户端(浏览器)给服务器发送请求,然后服务器再返回给客户端其要求的数据. 那么为什么说get也能提交数据呢? 我们仔细理解第一句话“客户端(浏览器) ...
- 在myeclipse下安装svn插件,出现了Could not generate DH keypair,这么一个错误。
解决方法: window-->preferences-->Team-->SVN-->SVN接口 选择:JavaHL 去https://sliksvn.com/download/ ...
- 大数相加a+b
#include<stdio.h>#include<string.h>#define MAX 1000void Add(char *a,char *b,char *result ...
- vue视频学习笔记05
video 5 vue2.0:bower info vue http://vuejs.org/到了2.0以后,有哪些变化? 1. 在每个组件模板,不在支持片段代码组件中模板:之前:<templa ...
- java内存模型二
数据依赖性 如果两个操作访问同一个变量,且这两个操作中有一个为写操作,此时这两个操作之间就存在数据依赖性.数据依赖分下列三种类型: 名称 代码示例 说明 写后读 a = 1;b = a; 写一个变量之 ...
- 【转】一分钟内检查Linux服务器性能
近期看了一篇运维排查的问题的十条命令,仔细看了一下,发现就是自己平时经常使用的一些,感觉还不错,就转一发~分享学习~ 如果你的Linux服务器突然负载暴增,告警短信快发爆你的手机,如何在最短时间内找出 ...