摘要: 针对页面上的二级菜单,需要鼠标悬停才能进行操作。 /** * Clicks (without releasing) in the middle of the given element. This is equivalent to: * <i>Actions.moveToElement(onElem 阅读全文
posted @ 2017-11-09 10:57 Lozz 阅读(3499) 评论(0) 推荐(0) 编辑
摘要: 在测试过程中有时候会遇到反爬虫机制,一些元素会使用伪元素,这样在定位元素的时候会定位不到,这时候就要使用js来帮助定位,获取到想要的元素 下面是部分代码 //使用js获取伪元素的content String script = "return window.getComputedStyle(docum 阅读全文
posted @ 2017-10-23 16:13 Lozz 阅读(2620) 评论(0) 推荐(0) 编辑
摘要: 之前在使用extentReport生成测试报告的时候,没有加载到相关的css,经检查为下面两个文件没有正确加载 后改变配置,加载本地的css和js文件,目前测试报告正确显示 1.创建TestNg的Report监听器,实现方法: private void init() { // TODO Auto-g 阅读全文
posted @ 2017-08-08 17:42 Lozz 阅读(1747) 评论(0) 推荐(0) 编辑
摘要: 有时候需要元素的截图,不需要整个截图。整理一个针对元素的截图的方法。 创建一个Java类,实现截取元素的方法 package com.lozz.utils; import java.awt.Rectangle; import java.awt.image.BufferedImage; import 阅读全文
posted @ 2017-07-28 17:04 Lozz 阅读(5875) 评论(6) 推荐(0) 编辑
摘要: Java环境配置 Eclipse配置TestNG Eclipse配置Maven pom.xml文件相关配置,添加依赖selenium和TestNg的jar包 <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/seleniu 阅读全文
posted @ 2017-07-20 11:06 Lozz 阅读(446) 评论(0) 推荐(1) 编辑