使用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. virtualbox中centos虚拟机网络配置

    本文讲述的是如何在Oracle VM VirtualBox安装的CentOS虚拟机中进行网络配置,使得虚拟机可以访问宿主主机,也能访问外网,宿主主机可以访问虚拟机,虚拟机之间也可以相互访问. 在Vir ...

  2. LeetCode OJ--Search in Rotated Sorted Array II

    http://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/ 如果在数组中有重复的元素,则不一定说必定前面或者后面的一半是有序的 ...

  3. Struts2防止重复提交

    一般使用<interceptor-ref name="token"></interceptor-ref>或者<interceptor-ref name ...

  4. Rmq Problem

    大视野——3339: Rmq Problem Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 1192  Solved: 620[Submit][Sta ...

  5. ubuntu下安装翻译软件

    原文: http://sixipiaoyang.blog.163.com/blog/static/6232358820144146386437/ Ubuntu下常用的翻译软件有StarDict,Gol ...

  6. ansible、zabbix、tcpdump

    Ansible 源码安装 https://blog.csdn.net/williamfan21c/article/details/53439307 Ansible安装过程中常遇到的错误 http:// ...

  7. Mac电脑解压文件unrar用密码问题解决

    下载了一个rar文件,有密码的,你懂的. 但是在mac上面,用unrar解压,只能解出空文件:用izip解压,直接停在那里不动. 只好上网搜索.找到了办法. 用brew 安装了命令行版本的 unrar ...

  8. 基于MNIST数据的softmax regression

    跟着tensorflow上mnist基本机器学习教程联系 首先了解sklearn接口: sklearn.linear_model.LogisticRegression In the multiclas ...

  9. C++ 宏定义与常量

    原文: http://blog.csdn.net/t894690230/article/details/50605021 前言:突然想起很久之前上课时被问及C++ 宏定义与常量的区别,仔细了想了想,并 ...

  10. 如何推断一个P2P平台是否靠谱?

    推断一个站点,是否靠谱.是有规律可循的.P2P平台算是个新兴的电商类站点.   网上欺诈类的站点.不限于P2P,实在是太多了,真的有必要总结下最关键的几个靠谱指标.   最关键的2个   1.创始人和 ...