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. (1)git

    1.创建一个版本库 #创建一个文件夹 E:\>mkdir pythonGit #进入文件夹 E:\>cd pythonGit #把此目录创建成git版本库 E:\pythonGit> ...

  2. T1229 数字游戏 codevs

    http://codevs.cn/problem/1229/ 题目描述 Description Lele 最近上课的时候都很无聊,所以他发明了一个数字游戏来打发时间.  这个游戏是这样的,首先,他拿出 ...

  3. luogu P1351 联合权值

    题目描述 无向连通图G 有n 个点,n - 1 条边.点从1 到n 依次编号,编号为 i 的点的权值为W i ,每条边的长度均为1 .图上两点( u , v ) 的距离定义为u 点到v 点的最短距离. ...

  4. Go -- log4go日志

    折腾: [已解决]go语言中实现log信息同时输出到文件和控制台(命令行) 期间,已经通过io的MultiWriter搞定了同时输出信息到文件和console,但是不支持level. 所以,再去试试这 ...

  5. 关于linter

    各类代码都有规则格式检查工具,称之为linter 比如:csslint/jslint/eslint/pylint sumlime提供了一个linter的框架SublimeLinter,在里面可以使用各 ...

  6. pyv8的安装和使用:python中执行js代码

    pyv8 的作用是在python中执行js代码,然后可以使用js里的变量等内容.python取得javascript里面的值.javascript取得python里面的值.python和javascr ...

  7. c++中vector向量几种情况的总结(向量指针,指针的向量)

    1.标准库vector类型 vector 是同一种类型的对象的集合.每一个对象都有一个相应的整数索引值.标准库将负责管理与存储元素相关的内存.我们把 vector 称为容器,是由于它能够包括其它对象. ...

  8. HDU 2845 Beans (两次线性dp)

    Beans Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Subm ...

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

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

  10. Eclipse打包Android项目时用到proguard.cfg后,出现的Warning:can&#39;t find referenced class问题的解决方式

    Warning: can't find superclass or interface Warning: can't find referenced class 这两个问题的解决方法: 1.要把你项目 ...