selenium - 使用 selenium 在全日历调度程序中单击日期
问题描述
我想创建单击日期以创建事件的自动测试。这里的问题是单元格不是 dom 元素。到目前为止我提出的解决方案是计算光标单击的坐标,但它不起作用。
WebDriver driver = getDriver();
Actions actions = new Actions(driver);
// Get absence calendar
WebElement absenceCalendar = getAbsenceCalendar(driver);
// Get X coordinate for the first monday of the month. Add 5px in order to close in to the center
int xCoordinates = getFirstDayFromAnyCalendar(absenceCalendar,"L").getLocation().getX()+5;
logger.info("X: "+xCoordinates);
// Get Y coordinate from jeune
int yCoordinates = getJeuneLineFromCalendar(absenceCalendar,jeune).getLocation().getY();
logger.info("Y: "+yCoordinates);
//Move the cursor to the top left corner of the screen
actions.moveToElement(driver.findElement(By.tagName("body")), 0, 0);
//Move the cursor to the coordinates and click.
actions.moveByOffset(xCoordinates, yCoordinates).click().perform();
坐标签出,但单击不起作用。任何想法 ?
解决方案
推荐阅读
- sql - 我可以创建一个查询来存储我的过程以应用于 Access/SQL 中具有相同结构的不同表吗?
- python-3.x - Tensorflow 图转换因 quantize_nodes 而中断
- java - 如何使用 QUADRATIC Bezier 曲线近似圆的 OCTANT?
- javascript - 只有数组的第一个元素已输出到谷歌表,我需要输出所有元素(空/未定义元素除外)
- rx-java - 使用 RxJava 同时做两件事
- powershell - 从 Powershell 中的参数中删除前导 0
- sql - CASE WHEN 语句中需要的 SQL 别名列名
- fft - 外推傅里叶预测金融
- python - 如何检查numpy数组中列中的值
- php - Laravel 重命名文件