0

アカウントメニューがあります。その上にマウスを置くと、そのサブメニューが画面に表示されます。スクリーンショットは以下の通りです。

ここに画像の説明を入力

アカウントの概要をクリックしたいのですが、私のセレンコードは次のとおりです。

def test_accounts(self):
    self.login(self.driver,properties.userid,properties.password)

    element_to_hover=self.driver.find_element_by_link_text('Accounts')
    hover=ActionChains(self.driver).move_to_element(element_to_hover)
    hover.click().perform()
    self.driver.implicitly_wait(10)
    self.driver.find_element_by_link_text('Account Summary').click()

次のエラーが表示されます。

    test_accounts (__main__.TestCase) ... ERROR

======================================================================
ERROR: test_accounts (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\New Workspace\Python Test\src\login.py", line 78, in test_accounts
    self.driver.find_element_by_link_text('Account Summary').click()
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 51, in click
    self._execute(Command.CLICK_ELEMENT)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 225, in _execute
    return self._parent.execute(command, params)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 160, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 149, in check_response
    raise exception_class(message, screen, stacktrace)
MoveTargetOutOfBoundsException: Message: '' 

----------------------------------------------------------------------
Ran 1 test in 24.563s

FAILED (errors=1)

SO などで多くのリンクを試しましたが、問題の解決策を見つけることができませんでした。私は Selenium の初心者なので、これはリンクにマウスを合わせて非表示のサブ要素に移動する正しい方法ですか?

私はpython 2.7を使用しています。どんな助けでもいただければ幸いです

4

2 に答える 2

0

イベントの連続は次のようにすべきだと思います: 要素 Accounts に移動 -> 要素 Account summary に移動 -> 要素をクリック -> 実行

于 2013-10-25T10:15:13.013 に答える