动作链在Safari浏览器中失败

时间:2018-09-26 11:41:14

标签: macos selenium selenium-webdriver safari macos-mojave

我正在尝试在Safari 12.0浏览器中使用ActionChains创建移动到元素动作,但遇到下一个错误:

selenium.common.exceptions.InvalidArgumentException: Message: Encountered key input source with invalid 'value' in payload: {
actions =     (
            {
        duration = 0;
        type = pause;
    }
);
id = key;
type = key;
}

同一测试在所有浏览器(Firefox,Chrome,IE,Edge等)中均成功通过,但在Safari中失败。

创建此操作的源代码:

element_to_hover_over = driver.find_element_by_xpath('/html/body/div[7]/div[1]/header/div[1]/div/ul/li[1]/div[1]/span[1]')
hover = ActionChains(driver).move_to_element(element_to_hover_over)
hover.perform()

1 个答案:

答案 0 :(得分:0)

评论类#self.w3c_actions.key_action.pause()中的行ActionChains为我解决了问题 但是这是一种解决方法,需要驱动程序进行适当的修复