[Selenium] Selenium 疑难杂症
1. jsclick 也不管用
Actions action = new Actions(driver);
WebElement theRow = page.getInvisibleElement();
action.moveToElement(theRow).perform();
page.getInvisibleElement().click(); 或page.getInvisibleElement().click();再获取一遍theRow
2.Issue : Cannot get text of a hidden element, SeleniumUtil. scrollIntoView(element) also doesn’t work for the element
Solution : JavaScript to get the text of hidden element.
Code :
WebElement tickerEl = el.findElement(By.cssSelector("td.auto-left"));
String tickerName = (String) ((JavascriptExecutor) driver).executeScript("return jQuery(arguments[0]).text();", tickerEl);
String tickTmp =StringUtils.trim(tickerName);
logger.info("Ticker : "+tickTmp);

3.Issue : Search function doesn't work sometime after we input the search condition, I guess it may cause by the realization method, the UI may only check the search condition each period of time,
If the input miss the check, we need to input again
Solution : If the drop down list doesn’t display the first time after inputting search condition, clear it and input the search condition again



4.Issue : Cannot get text of the columns which doesn’t show out, we need to drag the scroll bar to make it display when do testing manually.
Solution : Use SeleniumUtil.scrollIntoView(driver, el);
Code :
for (WebElement el : columns) {
if(!(el.isDisplayed())){
SeleniumUtil.scrollIntoView(driver, el);
}
logger.info("Column : " + el.getText());
… …
}

5.问题:元素定位方法没有错,但却定位不到元素


解决方法:发现网页有2个frame,需要定位的元素在左侧frame中,需要先跳转到左边的frame

代码:

6.问题:“确认”按钮通过class name或 css定位不到

解决方法:
通过xpath 定位,再点击
[Selenium] Selenium 疑难杂症的更多相关文章
- Python selenium —— selenium与自动化测试成神之路
From: https://blog.csdn.net/huilan_same/article/details/52559711 忽然想谈谈自动化的学习路径,因为发现很多人总是急于求成,不懂该如何学习 ...
- ubuntu 安装 selenium selenium操作 chrome
重装虚拟机,好多包需要重装,sele这个记得当时就找了好久的完整重装方法,这次又找了好久,,,省的下次再这样,记录下来..... ubuntu16.04 4安装seleniumsudo pip ins ...
- 跟浩哥学自动化测试Selenium -- Selenium简介 (1)
Selenium 简介 Selenium 是一款开源的web自动化测试工具,用来模拟对浏览器的操作(主要是对页面元素的操作),简单来讲,其实就是一个jar包.Selenium早期的版本比如1.0市场占 ...
- selenium===selenium自动化添加日志(转)
本文转自 selenium自动化添加日志 于logging日志的介绍,主要有两大功能,一个是控制台的输出,一个是保存到本地文件 先封装logging模块,保存到common文件夹命名为logger.p ...
- python + selenium - selenium简介
1. 产品简介 selenium 是 基于 web网页的UI自动化测试框架. 1)支持多浏览器操作:ie.chrome.firefox.edge.safaria等 2)跨平台:windows.linu ...
- [Selenium] Selenium WebDriver 的下载和安装
为配合较为广泛使用Java 语言的程序员,仅以WebDriver 的Java语言绑定进行讲解. 步骤1:下载并安装Java开发环境 1)在系统中安装JDK(Java开发工具吧,Java Develop ...
- [Selenium] Selenium find Element Examples
---> 1. By.id 以百度主页为例 <span classs = "bg s_ipt_wr"> <input type = "text& ...
- <selenium>selenium基础操作
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.c ...
- python + selenium - selenium常用元素定位
1. Chrome定位工具 打开Chrome浏览器,按F12会弹出开发者工具选项,选择Elements: 1)鼠标点击最左边箭头 2)鼠标滑动到页面中你要操作的元素,单击一下 3)对应的html元素内 ...
随机推荐
- 模拟用户登录-SpringMVC+Spring+Mybatis整合小案例
1. 导入相关jar包 ant-1.9.6.jarant-launcher-1.9.6.jaraopalliance.jarasm-5.1.jarasm-5.2.jaraspectj-weaver.j ...
- oracle分区表备份恢复
https://blog.csdn.net/jc_benben/article/details/51546815
- 关于错误Access Violation和too many consecutive exceptions 解决方法
关于错误Access Violation和too many consecutive exceptions 解决方法 “如果DLL中用到了DELPHI的string类型,则DLL和主程序中都需要加上Sh ...
- jpaRepository findById()数据库有数据却为null
oracle中的char类型用空格自动将字段补成指定的长度, 而varchar2类型不会.大部分情况下设计表字段类型都是varchar2,今天被char坑了一次, findById()始终为空..
- CODEVS 1245 最小的N个和 堆+排序
原题链接 http://codevs.cn/problem/1245/ 题目描述 Description 有两个长度为 N 的序列 A 和 B,在 A 和 B 中各任取一个数可以得到 N^2 个和,求 ...
- Codeforces 837 E Vasya's Function
Discription Vasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = ...
- tensorflow基础练习:线性模型
TensorFlow是一个面向数值计算的通用平台,可以方便地训练线性模型.下面采用TensorFlow完成Andrew Ng主讲的Deep Learning课程练习题,提供了整套源码. 线性回归 多元 ...
- BUPT复试专题—树查找(2011)
https://www.nowcoder.com/practice/9a10d5e7d99c45e2a462644d46c428e4?tpId=67&tqId=29641&rp=0&a ...
- SolidEdge如何绘制变化半径倒圆角
1 在要变化半径的边上打一些点 2 点击倒角命令的参数对话框,选择可变半径 3 选择倒角的直线,右击确认,再依次点击关键点,修改倒角数值,修改之后按回车,继续下一个点,直到结束.
- Go与C语言的互操作 cgo
http://tonybai.com/2012/09/26/interoperability-between-go-and-c/ // foo.h int count; void foo(); //f ...