方法:
增加Selenium2Library內部關鍵字
C:\Python37\Lib\site-packages\SeleniumLibrary\keywords\element.py
具體實現:
-
找到 C:\Python37\Lib\site-packages\SeleniumLibrary\keywords\element.py文件,文件末尾增加代碼
@keyword
def mouse_hover(self, locator):
‘’’
功能: 鼠標懸停
參數說明:locator 定位器
作者: XXX
日期: 20190131
更新記錄:
‘’’
element = self.find_element(locator)
action = ActionChains(self.driver)
action.move_to_element(element).perform()
如圖:
3. 保存後重新打開Robot Framework RIDE,則可像其它關鍵字一樣調用