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的更多相关文章

  1. selenium之坑(StaleElementReferenceException: Message: Element not found in the cache...)

    有时候循环点击一列链接,只能点到第一个,第二个就失败了 原因是第二个已经是新页面,当然找不到之前页面的元素.就算是后退回来的,页面也是不一样的 页面长的一样不一定是同一张页面,就像两个人长的一样不一定 ...

  2. selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document

    抓取网页代码后,由于是在同一个li标签下,所以使用一次性抓取,所有的a标签,然后循环做不同的操作,但是抛出找不到元素异常. def office_page(_chrome: Chrome): sn = ...

  3. 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 ...

  4. selenium使用过程中遇到的“element not visiable”错误

    PS:本博客selenium分类不会记载selenium打开浏览器,定位元素,操作页面元素,切换到iframe,处理alter.confirm和prompt对话框这些在网上随处可见的信息:本博客此分类 ...

  5. selenium在chrome上运行报 Element is not clickable at point (1096, 26)

    Firefox上正常运行的脚本在chrome上提示Element is not clickable at point (1096, 26).分析原因,首先肯定不是因为页面元素不存在而无法点击.也不是要 ...

  6. selenium之 坑(StaleElementReferenceException: Message: Element not found in the cache...)

    今天给大家分享一个selenium中经常会有人遇到的坑: selenium.common.exceptions.StaleElementReferenceException: Message: Ele ...

  7. 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 ...

  8. selenium中,8种 find element 方法

    -*- coding;utf-8 -*- from selenium import webdriver dr = webdriver.Chrome() dr.get("https://www ...

  9. Selenium 错误处理之:stale element reference: element is not attached to the page document

    出现该错误的原因是页面在获取到DOM元素之后到引用元素之间页面进行了刷新,所以需要再次获取该DOM元素即可.

随机推荐

  1. 第2章 CentOS网络配置

    一.配置说明 1.1 说明 1.本文以VM仅本机模式下与宿主机的网络配置为例. 1.2 达成目标 1.Windows能ping通centOS 2 centOS能够ping通Windows 3 cent ...

  2. Linux最常用的命名

    一.环境配置 vim /etc/sysconfig/network-scripts/ifcfg-eth0 vim /etc/sysconfig/network vim /etc/hostname vi ...

  3. IntelliJ IDEA出现:This file is indented with tabs instead of 4 spaces的问题解决

    根据阿里巴巴Java开发手册,不能使用Tab字符,改成4个字符,设置如下: 注意:是不选择! 一定要选择这个:

  4. InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pa

    2016-09-14T09:17:37.713955Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleane ...

  5. PYTHON 源码

    http://www.wklken.me/index2.html http://blog.csdn.net/dbzhang800/article/details/6683440

  6. (CF)Codeforces445A DZY Loves Chessboard(纯实现题)

    转载请注明出处:http://blog.csdn.net/u012860063? viewmode=contents 题目链接:http://codeforces.com/problemset/pro ...

  7. 转: 工欲善其事,必先利其器系列--Netbeans之远程开发

    转自: http://www.cnblogs.com/zuoca/archive/2012/07/09/Remote_Development_With_Netbeans_origin.html 工欲善 ...

  8. Android App 隐藏标题栏+状态栏+导航栏

    1. 隐藏当前Activity标题栏 在当前Activity中调用:this.requestWindowFeature(Window.FEATURE_NO_TITLE); 2. 隐藏当前Activit ...

  9. github 新建远程仓库 及 删除远程仓库

    一.新建远程仓库 1.点击 ' + ' 号 2.选择 ' new repository ' 3.填写信息  创建仓库 二.删除远程仓库 1.点击 ' Settings ' 按钮 2.滑动到最底部,点击 ...

  10. linux系列之-—03 压缩和解压缩命令

    tar命令 解包:tar zxvf FileName.tar 打包:tar czvf FileName.tar DirName gz命令 解压1:gunzip FileName.gz 解压2:gzip ...