【问题标题】:Unable to drag & drop the box in selenium无法在硒中拖放框
【发布时间】:2018-08-16 07:09:33
【问题描述】:

我正在尝试应用拖放功能。它既没有给我错误也没有工作。框的 XPath(我需要拖放)是正确的,我可以点击它。请建议 enter image description here

【问题讨论】:

  • 必须提供HTML和试用码

标签: selenium drag-and-drop


【解决方案1】:

首先,你的问题没有 Html,我给出的答案是通用的

 public static void main(String[] args) throws Exception {
 driver.get(URL you want to hit);

 //Element which needs to drag.         
 WebElement FromElem=driver.findElement("Locator"));

 //Element on which need to drop.       
 WebElement ToElem=driver.findElement("Locator"));  

 //Using Action class for drag and drop.        
 Actions act=new Actions(driver);   

 //Dragged and dropped.     
 act.dragAndDrop(FromElem, ToElem).build().perform();   

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-29
    • 2022-06-24
    • 1970-01-01
    • 2018-02-14
    • 2015-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多