使用moveToElement可是实现定位焦点,尝试后测试通过,代码如下
      //鼠标单击前商品信息被隐藏,我们需要手动除展示商品标签的隐藏属性
     JavascriptExecutor removeAttribute = (JavascriptExecutor)driver;    
     removeAttribute.executeScript("document.getElementsByClassName('XXX')[0].style.display='block';", new Object[0]);
     
        //将鼠标移动到输入框中
     Actions action =new Actions(driver);
     WebElement gaikuang=driver.findElement(by(bytype, object));
     action.moveToElement(gaikuang).click().perform();

【Selenium】Action.moveToElement的更多相关文章

  1. 【Selenium】各浏览器(firefox,chrome,ie)驱动下载地址汇总

    前两天使用Selenium分布式时,总抛出异常.更新成最新驱动可以解决.其中chrome异常如下, "platform": "WINDOWS" File &qu ...

  2. 【Selenium】【BugList11】启动selenium server报错:Unsupported major.minor version 52.0

    [环境信息] python:3.6.5 平台:win7 selenium:3.11.0 selenium server:selenium-server-standalone-3.11.0.jar jd ...

  3. 【Selenium】【BugList10】smtp发送邮件问题汇总:550/535/554

    [场景] 通过126邮箱向QQ邮箱发送HTML格式邮件 [代码1] from email.mime.text import MIMEText from email.header import Head ...

  4. 【Selenium】【BugList8】126邮箱定位不到“退出”按钮:Message: TypeError: can't access dead object

    [流程描述] 登录126邮箱,退出 [代码] #coding=utf-8 from selenium import webdriver driver = webdriver.Firefox() #dr ...

  5. 【Selenium】【BugList7】执行driver.find_element_by_id("kw").send_keys("Selenium"),报错:selenium.common.exceptions.InvalidArgumentException: Message: Expected [object Undefined] undefined to be a string

    [版本] selenium:3.11.0 firefox:59.0.3 (64 位) python:3.6.5 [代码] #coding=utf-8 from selenium import webd ...

  6. 【Selenium】【BugList9】windows环境,fp = open("./"+ time.strftime("%Y-%m-%d %H:%M:%S") + " result.html",'wb'),报错:OSError: [Errno 22] Invalid argument: './2018-09-05 10:29:32 result.html'

    [代码] if __name__=="__main__": suite = unittest.TestSuite() suite.addTest(Baidu("test_ ...

  7. 【Selenium】跳转问题

    /** * rewrite the get method, adding user defined log</BR> * 地址跳转方法,使用WebDriver原生get方法,加入失败重试的 ...

  8. 【Selenium】1.介绍 Selenium

    本文供学习交流之用,没有商业用途,没有盈利. 完全是我自己为督促自己学习而翻译的.翻译的不好,见谅.来源于:http://www.guru99.com/introduction-to-selenium ...

  9. 【转】Action 、 RenderAction 、 Partial 、 RenderPartial 区别

    1.Action . RenderAction Action 方法以字符串的形式返回子视图,可以直接被呈现.RenderAction方法在适当的地方呈现子视图. //One alternative ( ...

随机推荐

  1. PatentTips - Optimizing Write Combining Performance

    BACKGROUND OF THE INVENTION The use of a cache memory with a processor facilitates the reduction of ...

  2. HDU 5667 Sequence【矩阵快速幂+费马小定理】

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5667 题意: Lcomyn 是个很厉害的选手,除了喜欢写17kb+的代码题,偶尔还会写数学题.他找到 ...

  3. 快速掌握RabbitMQ(二)——四种Exchange介绍及代码演示

    在上一篇的最后,编写了一个C#驱动RabbitMQ的简单栗子,了解了C#驱动RabbitMQ的基本用法.本章介绍RabbitMQ的四种Exchange及各种Exchange的使用场景. 1 direc ...

  4. let与const命令

    (需要注意的地方) 1.ES6 新增了let命令,用来声明变量.它的用法类似于var,但是所声明的变量,只在let命令所在的代码块内有效. 2.for循环还有一个特别之处,就是设置循环变量的那部分是一 ...

  5. 【面试 JDK】【第一篇】Object类面试详解

    1.Object类有哪些方法 1>clone()方法 保护方法,实现对象的浅复制,只有实现了Cloneable接口才可以调用该方法,否则抛出CloneNotSupportedException异 ...

  6. Qt5官方demo解析集30——Extending QML - Binding Example

    本系列全部文章能够在这里查看http://blog.csdn.net/cloud_castle/article/category/2123873 接上文Qt5官方demo解析集29--Extendin ...

  7. python各种类型转换

    python各种类型转换 学习了:https://blog.csdn.net/shanliangliuxing/article/details/7920400 https://blog.csdn.ne ...

  8. 修改ubuntu系统时区

    ubuntu默认时区是Etc/UTC,和我们的北京时间相差8个时区,需要修改系统的时区,以下有两种简单方式修改系统时区: 1.修改/etc/timezone文件 vi /etc/timezone 把E ...

  9. Android 系统广播机制

    一.Android应用程序注冊广播接收器(registerReceiver)的过程分析 參考Android应用程序注冊广播接收器(registerReceiver)的过程分析http://blog.c ...

  10. VS2013 update4+Cocos2d-x 3.7 Win8下安装方法及配置

    1.安装VS 2013 update4 7个G.自己就去网上找吧,一大堆,密钥问度娘. 2.安装及配置python 2.x 这里注意,一定要下载python 3.0下面的版本号. 配置:进行环境变量配 ...