使用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. AtCoder Grand Contest 005F - Many Easy Problems

    $n \leq 200000$的树,从树上选$k$个点的一个方案会对$Ans_k$产生大小为“最小的包括这$k$个点的连通块大小”的贡献.求每个$Ans_k$.膜924844033. 看每个点对$An ...

  2. POJ Blue Jeans [枚举+KMP]

    传送门 F - Blue Jeans Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u ...

  3. asp.net core系列 65 正反案例介绍SOLID原则

    一.概述 SOLID五大原则使我们能够管理解决大多数软件设计问题.由Robert C. Martin在20世纪90年代编写了这些原则.这些原则为我们提供了从紧耦合的代码和少量封装转变为适当松耦合和封装 ...

  4. 安装配置JDK+Eclipse+Maven、Eclipse里新建Maven Project以及HDFS命令和Java API-课堂内容

    步骤:1.安装JDK→2.安装Eclipse→3.安装Maven→4. Eclipse里配置Maven (下载Windows版本,在Windows里安装使用.) 1.安装配置JDK ①官网下载Java ...

  5. java之static变量与全局、局部变量的区别

    static变量与全局.局部变量的区别 全局变量(外部变量)的说明之前再冠以static 就构成了静态的全局变量.全局变量本身就是静态存储方式,静态全局变量当然也是静态存储方式.这两者在存储方式上并无 ...

  6. jsp学习笔记总结

    Cookie中对保存对象的大小是有限制的 解决cookie中无法保存中文的问题: request.setCharacterEncoding URLEncoder.encode()编码 URLDecod ...

  7. 前端编程提高之旅(五)----写给大家看的css书

       自实习也有几个月的时间了,以爱奇艺实习为敲门砖.进入了眼下这家公司.假设说当初能进爱奇艺是暂时袭击DIV+CSS的话,眼下在这家公司体验到.不论什么技术都必须悉知原理,这样才干做到庖丁解牛.做一 ...

  8. Jupyter notebook 使用Turorial

    The cell magics in IPython http://nbviewer.jupyter.org/github/ipython/ipython/blob/1.x/examples/note ...

  9. Comparable 和 Comparator的理解

    对Comparable 的解释 Comparable是一个排序接口 此接口给实现类提供了一个排序的方法,此接口有且只有一个方法 public int compareTo(T o); compareTo ...

  10. 项目Beta冲刺(团队3/7)

    项目Beta冲刺(团队3/7) 团队名称: 云打印 作业要求: 项目Beta冲刺(团队) 作业目标: 完成项目Beta版本 团队队员 队员学号 队员姓名 个人博客地址 备注 221600412 陈宇 ...