为什么我的硒不能拖放任何感觉

2024-09-29 05:29:12 发布

您现在位置:Python中文网/ 问答频道 /正文

enter image description

我在做自动测试,我想把左边的文档拖到图片右边的画布单元格中。不管我用什么命令,比如拖放,点击并按住。文档不会拖到画布单元格。在

    drag_1 = gt("//button[@class='mat-icon-button']")
    drag_a = gt("//div[@class='dynamic-container']")
    action.drag_and_drop(drag_1, drag_a).perform()

这是我用来将drag_1拖到drag_a的代码,但它并不有效。在


Tags: 文档命令gtdivcontainer画布图片button
1条回答
网友
1楼 · 发布于 2024-09-29 05:29:12

看看this answer

总结一下它说的话:

Actions builder = new Actions(driver);

Action dragAndDrop = builder.clickAndHold(someElement)
   .moveToElement(otherElement)
   .release(otherElement)
   .build();

dragAndDrop.perform();

在Python中,这将转换为

^{pr2}$

相关问题 更多 >