Selenium错误:提供给交互操作的坐标无效

时间:2017-12-08 07:08:11

标签: selenium

以下是我正在使用的代码。它早先工作但现在它抛出错误。我需要执行正确的滑动。

const TouchAction = wd.TouchAction;
exports.swipeSportsHorizontally = async function (driver) {
    try {   console.log("Calling swipe sports horizontally");
let locationOfSportsIcons = await driver.elementById('com.techmash.playo:id/sports_list_linear_layout').getLocation();
        let action = new TouchAction(driver);
        action
            .press({ x: 800, y: locationOfSportsIcons.y })
            .wait(2000)
            .moveTo({ x: 443, y: locationOfSportsIcons.y })
            .wait(2000)
            .release();
     return await action.perform();
    } catch (err) {
        console.log(err);
    }``
};

抛出的错误如下 -

{"message":"[performTouchAction([{\"action\":\"press\",\"options\":{\"x\":800,\"y\":243}},{\"action\":\"wait\",\"options\":{\"ms\":2000}},{\"action\":\"moveTo\",\"options\":{\"x\":443,\"y\":243}},{\"action\":\"wait\",\"options\":{\"ms\":2000}},{\"action\":\"release\",\"options\":{}}])] Error response status: 29, , InvalidElementCoordinates - The coordinates provided to an interactions operation are invalid. Selenium error: The coordinates provided to an interactions operation are invalid.","stat...

任何人都可以帮我吗?

0 个答案:

没有答案