2016-01-12 8 views
6

私はドラッグドロップアクションの自動テストにselenium2libraryを使用しています。私はWindows 8 64bit、Selenium 2.48.0、ride.pyで動作しています。テストに使用しているブラウザ:Firefoxとクローム最新の安定版は私がやったことactionchain()を使用するとセレンがハングします。move then actionchain.clickまたはmouse_up

は、入力されたテキストやリンクをダミーHTMLページを作成し、入力されたテキストここ

にリンクドラッグを試してみたHTMLは次のとおりです。移動仕上げまたはMOUSE_DOWN()仕上げは、次のアクションがperforされていないときに私が見つけたもの

class CustomSeleniumLibrary(Selenium2Library): 
... 
    def test_drag(self): 
     self.open_browser("http://localhost:8080/a.html", "firefox") 
     source = self._element_find("//a[@id='source']", True, True) 
     target = self._element_find("//input[@id='target']", True, True) 
     drag = ActionChains(self._current_browser()).click_and_hold(source) 
     moveDum = ActionChains(self._current_browser()).move_by_offset(1,1) 
     move = ActionChains(self._current_browser()).move_to_element_with_offset(target,1,1) 
     #I have also tried ActionChains().drag_and_drop().perform() or make a dummy move move_by_offset followed by move_to_element_with_offset but no use 
     drag.perform() 
     moveDum.perform() 
     move.perform() 

は次のとおりです。

<div id="wrapper"> 

<input id="target" type="text" style="width:200px; height:50px" /> 
</div> 
<a id="source" href="http://google.com" >drag me </a> 

そして、ここでは、自動化のための私のpythonのコードです私がリンクを保持しているのを見ることができますが、マウスを手動でブラウザに移動するまで移動アクションは実行されません。 ride.py UI当時のフリックと要求: 16:24:47.042 : DEBUG : POST http://127.0.0.1:58095/hub/session/fa7590b6-396f-4cb5-a08a-e35138a9216e/moveto {"sessionId": "fa7590b6-396f-4cb5-a08a-e35138a9216e", "element": "{6586b4ae-3c51-4e18-bb40-e006af369768}", "xoffset": 1, "yoffset": 1}

私はあなたの誰を行い、ブラウザ

に手動でマウスを移動するまで永遠にハングアップし、同じ問題を抱えて、または私が何か間違ったことをしましたか?また、robotframework selenium2libraryを使用してdraganddrop機能を使用するための提案はありますか?

敬具、 ダン

+0

動作するかどうか、私に教えてくださいコマンドごとに別々に 'perform()'メソッドを呼び出すのではなく、1つのアクションとしてチェーン内のコマンドを実行します。 – Andersson

答えて

2

私はそれを確認することはできませんが、私はこのようにActionChains作品を覚えている:

actions = ActionChains(self._current_browser()) 
actions.click_and_hold(source) 
actions.move_by_offset(1,1) 
actions.move_to_element_with_offset(target,1,1) 
actions.perform() 

は、このコードが誤ってあなたが実行する必要が

+0

答えがありがとうございますが、うまくいきました。私はclick_and_holdまたはmouse_downを実行してからmove_to_element(another_element)を実行し、ride.pyがハングしていることを示し、セッションを作成して移動アクションを実行するlocalserverに接続しようとすると、ハングします(リクエストを参照してください私は質問に投稿しました) –

+0

'Chrome'ブラウザを使用していますか? – Andersson

+0

私はChromeとfirefoxの両方を使用しています –

関連する問題