我正在尝试使用机器人框架中的 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>