How to click a link / button implemented as a div or span element with WebDriver
2016-03-11 17:27
477 查看
http://sqa.stackexchange.com/questions/2918/how-to-click-a-link-button-implemented-as-a-div-or-span-element-with-webdriver
使用div实现了button和link
in my testing I need to click on a 'link' or a 'button' (actually it just looks like and functions as a link or a button) that is implemented as a div (or span) element. With Selenium IDE, I tried with either clickAt or mouseDown command, both worked fine to
successfully click that 'link' or 'button'. However, in WebDriver, it seems that currently there is no click_at method (using Python binding), can anyone please help me on this, or is there any workaround available? Thanks.
P.S. As an example, I noticed that in Gmail, the "COMPOSE" button is implemented as a div element.
Apologies - I don't know Python, but in C# I'm able to click elements with any tag by using
clicking. This way Webdriver is clicking based on location. For example:
Something similar might work for Python.
Great thanks @SteveCZ, it is working in Python with similar method as:
<br/>ActionChains(driver).move_to_element(targetElement).click().perform()
使用div实现了button和link
in my testing I need to click on a 'link' or a 'button' (actually it just looks like and functions as a link or a button) that is implemented as a div (or span) element. With Selenium IDE, I tried with either clickAt or mouseDown command, both worked fine to
successfully click that 'link' or 'button'. However, in WebDriver, it seems that currently there is no click_at method (using Python binding), can anyone please help me on this, or is there any workaround available? Thanks.
P.S. As an example, I noticed that in Gmail, the "COMPOSE" button is implemented as a div element.
Apologies - I don't know Python, but in C# I'm able to click elements with any tag by using
MoveToElement()before
clicking. This way Webdriver is clicking based on location. For example:
new Actions(driver).MoveToElement(mySpanElement).Click().Perform();
Something similar might work for Python.
Great thanks @SteveCZ, it is working in Python with similar method as:
<br/>ActionChains(driver).move_to_element(targetElement).click().perform()
相关文章推荐
- 2014ACMICPC亚洲区域赛牡丹江现场赛之旅
- git下的团队合作模型及git基础知识汇集
- java变量声明和字符输出
- 北京丁丁租房招聘JAVA开发人员
- C#程序设计教程编程题(一)
- 小米手机TCP连接一些奇怪现象
- 无限分类的两种方法
- 2016年c#实验2.2
- 畅通工程
- GridBagLayout:网格包布局管理器
- Lua相关的知识
- 百度网盘下载使用方法
- 上传控件伪点击
- 06章:事务、视图和索引
- 死锁问题(一)
- kali linux下的嗅探工具介绍
- 最全Linux 与 Linux Windows 文件共享
- JS封装类或对象的最佳方案
- 跟踪分析Linux内核的启动过程
- linux golang的安装