【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文件添 ...
随机推荐
- css过渡模块和2d转换模块
今天,我们一起来研究一下css3中的过渡模块.2d转换模块和3d转换模块 一.过渡模块transition (一)过度模块的三要素: 1.必须要有属性发生变化 2.必须告诉系统哪个属性需要执行过渡效果 ...
- CentOS下安装JDK的三种方法
方法一:手动解压JDK的压缩包,然后设置环境变量 1.在/usr/目录下创建java目录 [root@localhost ~]# mkdir/usr/java[root@localhost ~]# c ...
- C#图像处理——ImageProcessor
这是个老生常谈的话题,需求实在太多,而且也较简单,写此文也是因为几个月没写技术文章了,权当为下一步开个头.我之前也做过很多此类项目,但是就我自己来说每次处理方式还都不一样,有用OpenCV的,有用Ma ...
- 完美实现在同一个页面中使用不同样式的artDialog样式
偶然发现artDialog.js这个插件,就被其优雅的设计及漂亮的效果深深吸引,在做例子时碰到了一些想当然它应该提供但却没有提供的功能,不过这都不影响我对它的喜爱,下面说一下遇到的问题吧! artDi ...
- J2EE struts2MVC应用在线书签1
序:之前花了一天研究了一下filter,虽然是实现了MVC模式开发了 WebBookmark,但是代码过于冗长,集中在filter中使用if语句不易阅读,为了体现两份作业的不同点,我决定学习 Java ...
- JS-监听文本回车事件写入数据表单
场景 ERP系统扫描输入货品编号到文本框后,触发写入记录到数据表格,并对数据进行渲染. 解决方案 通过发现回车或者换行符,则写入数据表格 代码 //监听文本框输入事件 $('#gidinp ...
- [刷题]算法竞赛入门经典(第2版) 4-5/UVa1590 - IP Networks
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa1590 - IP Networks #include<iost ...
- C++ 常见的 Undefined symbols for architecture *
出现 Undefined symbols for architecture x86_64: 的原因 1.函数申明了,却未被定义. 2.申明的虚函数未被实现. NOTE: a missing vtabl ...
- 你真的用好了Python的random模块吗?
random模块 用于生成伪随机数 源码位置: Lib/random.py(看看就好,千万别随便修改) 真正意义上的随机数(或者随机事件)在某次产生过程中是按照实验过程中表现的分布概率随机产生的,其结 ...
- JDK源码之AQS源码剖析
除特别注明外,本站所有文章均为原创,转载请注明地址 AbstractQueuedSynchronizer(AQS)是JDK中实现并发编程的核心,平时我们工作中经常用到的ReentrantLock,Co ...