遇到一个非常郁闷的问题,终于解决了,
问题是这样的,NN网站的价格计划,每一个价格计划需要三连击才能全部点开,第一个房型的价格计划是可以正确三连击打开的,可是第二个房弄就不行了,报错说不是可点击的元素,具体错误如下:WebDriverException: Message: Element is not clickable at point (1372.5, 9.5). Other element would receive the click: <li style="display: list-item;" id="tuanbox"></li>
 
 
 
逐一排除:
1) 点击的元素被其它元素遮挡,(不是,肉眼看没有被遮挡)
2) 元素没有加载出来就点击(也不是,我加了等待时间的,而且展开的加载很快的)
3)元素不在当前屏幕范围内(也不是,我将鼠标移动到了当前点击元素所在的位置了)
 
 
 
最后在网上搜到一篇文章:做点击操作时的错误WebDriverException: unknown error: Element is not clickable at point (958, 207).
 
这里说,原因:用selenium模拟用户单击元素时,JS有一个操作鼠标悬浮的时候会对元素进行修改
解决办法:用JS来操作元素,
没想到真的解决了呢。^.^
 
将:
driver.find_element_by_xpath("//div[@class=\"room-item-inner room-item-wrapper\"][" + str(i) + "]//a[@class=\"js-expand-more\"]").click
改为:

button = driver.find_element_by_xpath("//div[@class=\"room-item-inner room-item-wrapper\"][" + str(i) + "]//a[@class=\"js-expand-more\"]")
driver.execute_script("$(arguments[0]).click()",button)
 
selenium+python使用js点击元素:https://blog.csdn.net/u012189659/article/details/38496059
 
 
其他参考:selenium 之Action Chains类:https://www.cnblogs.com/cnkai/p/7538267.html

python+selenium:点击页面元素时报错:WebDriverException: Message: Element is not clickable at point (1372.5, 9.5). Other element would receive the click: <li style="display: list-item;" id="tuanbox"></li>的更多相关文章

  1. Python+Selenium自动化-定位页面元素的八种方法

    Python+Selenium自动化-定位页面元素的八种方法   本篇文字主要学习selenium定位页面元素的集中方法,以百度首页为例子. 0.元素定位方法主要有: id定位:find_elemen ...

  2. python控制selenium点击登录按钮时报错 unknown error: Element is not clickable at point

    利用python控制selenium进行一个网页的登录时报错: C:\Users\Desktop\selenium\chrome>python chrome.py selenium.common ...

  3. Python+Selenium自动化-获取页面信息

    Python+Selenium自动化-获取页面信息   1.获取页面title title:获取当前页面的标题显示的字段 from selenium import webdriver import t ...

  4. selenium:解决页面元素display:none的方法

    在UI自动化测试中,有时候会遇到页面元素无法定位的问题,包括xpath等方法都无法定位,是因为前端元素被设置为不可见导致. 这篇博客,介绍下如何通过JavaScript修改页面元素属性来定位的方法.. ...

  5. tomcat启动后,页面浏览时报错 Unable to compile class for JSP的解决方案

    转:tomcat启动后,页面浏览时报错 Unable to compile class for JSP的解决方案 检查tomcat与web工程对应版本,tomcat中对应版本的jar包拷贝到web工程 ...

  6. Python+Selenium自动化-定位一组元素,单选框、复选框的选中方法

    Python+Selenium自动化-定位一组元素,单选框.复选框的选中方法   之前学习了8种定位单个元素的方法,同时webdriver还提供了8种定位一组元素的方法.唯一区别就是在单词elemen ...

  7. python webdriver 报错WebDriverException: Message: can't access dead object的原因(pycharm中)

    PyCharm中运行firefox webdriver访问邮箱添加通讯录的时候报错-WebDriverException: Message: can't access dead object 调了半天 ...

  8. 利用 Python + Selenium 实现对页面的指定元素截图(可截长图元素)

    对WebElement截图 WebDriver.Chrome自带的方法只能对当前窗口截屏,且不能指定特定元素.若是需要截取特定元素或是窗口超过了一屏,就只能另辟蹊径了. WebDriver.Phant ...

  9. selenium 点击页面链接测试

    点击页面链接测试 http://www.51testing.com/html/21/n-862721.html 需求:现在有一个网站的页面,我希望用python自动化的测试点击这个页面上所有的在本窗口 ...

随机推荐

  1. Improving your submission -- Kaggle Competitions

    1: Improving Our Features In the last mission, we made our first submission to Titanic: Machine Lear ...

  2. 18位身份证验证(Java)加入身份证输入验证是否满足18位代码(修订稿)

    package day20181016; /** * 身份证的验证 34052419800101001X * */ import java.util.Scanner; public class Zuo ...

  3. tp5 中使用自定义扩展类和函数

    如果是要引用其它控制器里定义的方法参考:https://www.cnblogs.com/efyefy/p/8796014.html 如果在extend定义的类和函数默认是在全局命名空间下的 new \ ...

  4. centos 7 安装使用 redis

    1.下载redis,用wget就行,版本在这里找: http://download.redis.io/releases/ 2.安装gcc,tcl,用yum 安装. 3.解压,make ,make in ...

  5. 使用JBarcode生成一维码

    需要的jar包,只有jbarcode.jar 链接: https://pan.baidu.com/s/1o9oDPB8 密码: x367 public class Main { //设置条形码高度 p ...

  6. 2199: [Usaco2011 Jan]奶牛议会 2-sat

    链接 https://www.luogu.org/problemnew/show/P3007 https://www.lydsy.com/JudgeOnline/problem.php?id=2199 ...

  7. 【Hadoop 分布式部署 九:分布式协作框架Zookeeper架构 分布式安装部署 】

    1.首先将运行在本地上的  zookeeper 给停止掉 2.到/opt/softwares 目录下  将  zookeeper解压到  /opt/app 目录下 命令:  tar -zxvf zoo ...

  8. Leetcode121-Best Time to Buy and Sell Stock I - Easy

    I Say you have an array for which the ith element is the price of a given stock on day i. If you wer ...

  9. Codeforces Round #107 (Div. 1) B. Quantity of Strings(推算)

    http://codeforces.com/problemset/problem/150/B 题意: 给出n,m,k,n表示字符串的长度为n,m表示字符种类个数,k表示每k个数都必须是回文串,求满足要 ...

  10. 报名 | 蚂蚁金服ATEC科技大会 · 上海:数字金融新原力

    小蚂蚁说: 2019年1月4日,蚂蚁金服ATEC城市峰会将以“数字金融新原力(The New Force of Digital Finance)”为主题,在中国上海举办.蚂蚁金服ATEC(Ant Te ...