Selenium2 + phpunit -> drag and drop on xpath

半世苍凉 提交于 2019-12-24 00:11:01

问题


I use PHPUnit_Extensions_Selenium2TestCase Selenium and phpunit and I need make drag and drop one xpath element, on diferent emelent. Like on this screen, to change position on tree (category tree)


回答1:


  $srcDrag=$this->byId('draggable');
  $targetDrop=$this->byId('droppable');
  $stateChecker=$this->byCssSelector('#droppable > p');
  $this->assertEquals("Drop here",$stateChecker->text());


  $this->moveto($srcDrag);
  $this->buttondown();
  $this->moveto($targetDrop);
  $this->buttonup();



回答2:


Drag and Drop from computer files is not possible. In addition to Shahriar's propose, you could also set value of the input to file location.

$input->value('d:\\1.jpg');



来源:https://stackoverflow.com/questions/23830113/selenium2-phpunit-drag-and-drop-on-xpath

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!