使用Python和webdriver--我试图为move_to_element()包含一个selenium调用,这样我就可以在一个页面对象中调用它来在测试脚本中使用。
例如,我有:
def find_element(self, locatorMode, Locator):
element = None
if locatorMode == LocatorMode.ID:
element = self.driver.find_element_by_id(Locator)
elif locatorMode == LocatorMode.NAME:
element = self.driver.find_element_by_name(Locator)
elif locatorMode == LocatorMode.XPATH:
element = self.driver.find_element_by_xpath(Locator)
elif locatorMode == LocatorMode.CSS_SELECTOR:
element = self.driver.find_element_by_css_selector(Locator)
else:
raise Exception("Unsupported locator strategy.")
return element
def hover_over(self, locatorMode, Locator):
self.find_element(locatorMode, Locator).move_to_element()
它一直给我一个属性错误。我试图将一个变量传递给它,没有运气。我在这里错过了什么?这可以通过此动作链动作实现吗?
答案 0 :(得分:0)