[Selenium] The commonly used operation of element
btnLogin.click(); //Click element
SeleniumUtil.jsClick(driver, saveButtonEl); //If click() is not applicable ,try this one
txtEmail.clear(); //Clear text box before send keys to it
txtEmail.sendKeys(“jenny.zhang@morningstar.com”); //Send keys to text box
emailEl.getAttribute("title"); //Get attribute value of element
hoverEl.getText(); //Get text of element
SeleniumUtil.scrollIntoView(driver, el); //Scroll the element into view if the function needs scroll bar or mouse wheel when manual testing
//Click a hidden element
action.moveToElement(pencilIcon).click();
//Before click an element under a hidden element
locx=(theRow.getSize().width)/100;
locy=(theRow.getSize().height)/2;
action.moveToElement(theRow, locx, locy);
//Get text of hidden element
String dataPointName = (String) ((JavascriptExecutor) driver).executeScript(
"return jQuery(arguments[0]).text();", element);
//Ctrl+click
Actions a = new Actions(driver);
a.keyDown(Keys.CONTROL).perform();
for(int i = 0;i<quantity;i++){
WebElement securityEl = securitiesList.get(i);
SeleniumUtil.scrollIntoView(driver, securityEl);
securityEl.click();
}
a.keyUp(Keys.CONTROL).perform();
//Drag and drop
Point targetWidgetPos = targetWidgetEl.getLocation();
Point widgetPos = widgetEl.getLocation();
int offsetX = targetWidgetPos.getX() - widgetPos.getX();
int offsetY = targetWidgetPos.getY() - widgetPos.getY();
SeleniumUtil.dragAndDropOffset(driver, titleEl, offsetX, offsetY);
[Selenium] The commonly used operation of element的更多相关文章
- selenium之坑(StaleElementReferenceException: Message: Element not found in the cache...)
有时候循环点击一列链接,只能点到第一个,第二个就失败了 原因是第二个已经是新页面,当然找不到之前页面的元素.就算是后退回来的,页面也是不一样的 页面长的一样不一定是同一张页面,就像两个人长的一样不一定 ...
- selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
抓取网页代码后,由于是在同一个li标签下,所以使用一次性抓取,所有的a标签,然后循环做不同的操作,但是抛出找不到元素异常. def office_page(_chrome: Chrome): sn = ...
- Selenium Xpath Tutorials - Identifying xpath for element with examples to use in selenium
Xpath in selenium is close to must required. XPath is element locator and you need to provide xpath ...
- selenium使用过程中遇到的“element not visiable”错误
PS:本博客selenium分类不会记载selenium打开浏览器,定位元素,操作页面元素,切换到iframe,处理alter.confirm和prompt对话框这些在网上随处可见的信息:本博客此分类 ...
- selenium在chrome上运行报 Element is not clickable at point (1096, 26)
Firefox上正常运行的脚本在chrome上提示Element is not clickable at point (1096, 26).分析原因,首先肯定不是因为页面元素不存在而无法点击.也不是要 ...
- selenium之 坑(StaleElementReferenceException: Message: Element not found in the cache...)
今天给大家分享一个selenium中经常会有人遇到的坑: selenium.common.exceptions.StaleElementReferenceException: Message: Ele ...
- selenium webdriver使用过程中出现Element is not currently visible and so may not be interacted with的处理方法
参考文章: http://blog.csdn.net/passionboyxie/article/details/28661107 http://www.spasvo.com/ceshi/open/k ...
- selenium中,8种 find element 方法
-*- coding;utf-8 -*- from selenium import webdriver dr = webdriver.Chrome() dr.get("https://www ...
- Selenium 错误处理之:stale element reference: element is not attached to the page document
出现该错误的原因是页面在获取到DOM元素之后到引用元素之间页面进行了刷新,所以需要再次获取该DOM元素即可.
随机推荐
- elasticsearch入门使用(三) Query DSL
Elasticsearch Reference [6.2] » Query DSL 参考官方文档 :https://www.elastic.co/guide/en/elasticsearch/refe ...
- Chrome V8系列--浅析Chrome V8引擎中的垃圾回收机制和内存泄露优化策略
V8 实现了准确式 GC,GC 算法采用了分代式垃圾回收机制.因此,V8 将内存(堆)分为新生代和老生代两部分. 一.前言 V8的垃圾回收机制:JavaScript使用垃圾回收机制来自动管理内存.垃圾 ...
- [bzoj1018][SHOI2008]堵塞的交通traffic_线段树
bzoj-1018 SHOI-2008 堵塞的交通traffic 参考博客:https://www.cnblogs.com/MashiroSky/p/5973686.html 题目大意:有一天,由于某 ...
- centos6安装概述
1.1.选择安装类型:[Install or upgrade an existing system]安装或升级现有系统 1.2.介质校验:[Skip]跳过介质校验,校验时间较长 1.3.语言选择:[E ...
- 转:Linux字符编码方式
首先,解释一下字符集: 汉字编码: * GB2312字集是简体字集,全称为GB2312(80)字集,共包括国标简体汉字6763个. * BIG5字集是台湾繁体字集,共包括国标繁体汉字13053个. * ...
- Info.plist 的字段解释
bundle字段 这些字段名都是XML中的名称,在xcode的属性编辑器中,名字并不相同 bundle目录中的属性列表详细描述了有关该bundle的信息.Finder和一些系统API在一些情况下会使用 ...
- IT部门的KPI该如何制定?
导语:信息化成本.系统开机率.网路不断线时数.系统运行速度.软件开发时间.用户问题处理反应时间.系统品质.用户满意度--哪些指标是可被管理的,能指引IT部门成为一个有价值的.为企业带来效益的部门呢? ...
- iinflux数据库使用
特殊用法: http://blog.fatedier.com/2016/07/05/research-of-time-series-database-influxdb/ 创建表及表中的key和valu ...
- iOS开发 检测版本更新
iOS开发 检测版本更新的实现 苹果给了我们一个接口,能根据应用id请求一些关于应用的信息.我们可以根据返回的信息,来判断版本是否和应用的版本一致,如果不一致,那么就出现新的版本了.这时,就需要向用户 ...
- add swapspace file on ubuntu.
https://askubuntu.com/questions/566745/allocate-swap-after-ubuntu-14-04-lts-installation ----------- ...