-3

我正在尝试使用机器人框架中的 Selenium 2 库单击弹出窗口上的按钮/元素,但出现错误。

这是代码:

Test Click Like
    Wait Until Page Contains Element    //iframe[@title="Facebook Social Plugin"]
    Select Frame    //iframe[@title="Facebook Social Plugin"]
    #Frame Should Contain    //*[@id="u_0_0"]/div/div/div[2]/div[1]/a/img[@src="https://www.facebook.com/rsrc.php/v1/yi/r/odA9sNLrE86.jpg"]
    Click Element    xpath=//*[@id='u_0_0']/div/div/div[3]/div[1]/div[2]/div/div[2]/div/div[2]/a[1]/em/*[@data-intl-translation="Thích"]
    Sleep    5s
    Capture Page Screenshot
    Wait Until Page Contains Element    xpath=//*[@id='u_0_0']/div/div/div[3]/div[1]/div[2]/div/div[2]/div/div[2]/a[1]/em/*[@data-intl-translation="Bỏ thích"]
    Sleep    5s
    Capture Page Screenshot

这是错误:

Error
ValueError: Element locator 'xpath=//*[@id='u_0_0']/div/div/div[3]/div[1]/div[2]/div/div[2]/div/div[2]/a[1]/em/*[@data-intl-translation="Thích"]' did not match any elements.

我有这个 HTML 代码:

<a href="#">
<em class="_4qba" data-intl-translation="Thích" data-intl-trid="">Thích</em>
</a>
4

1 回答 1

0

您必须首先选择该弹出窗口才能在该打开的弹出窗口上执行任何操作。

于 2017-03-22T06:10:46.310 回答