javascript - .location 和 getBoundingClientRect() 函数都返回相对于右上角的 x,y 坐标
问题描述
使用Selenium chrome 驱动程序定位Facebook.com 上登录按钮的坐标。所有其他字段位置都相对于左上角给出。
我努力了:
driver.execute_script('var rect = arguments[0].getBoundingClientRect(); return rect;', log_button))
log_button.location
解决方案
推荐阅读
- sql-server - 在 powershell 中使用 WMI 查询 SQL Server 数据库时出错
- c++ - 通过平移矩阵而不是 glTranslate() 在 OpenGL 中移动模型
- python-pptx - 在 python-pptx 中隐藏图表系列
- c# - 连接必须有效并打开 asp .net core
- php - 无法将 docker 用于 php 项目
- c - 为什么位为 01110011 的字节不会变成字符 `s`?
- python - 在 SQLAlchemy 中注释“exists”子查询
- php - 如何在php中格式化URL的字符串
- c# - 不可为空的整数在传递给存储过程时变为空
- javascript - 如何获取对象的元素?