gpt4 book ai didi

javascript - Protractor :如何拉伸(stretch)和替换元素?

转载 作者:行者123 更新时间:2023-11-30 16:43:34 25 4
gpt4 key购买 nike

我有这样的表格: enter image description here

我想模拟列的拉伸(stretch)。我也可以更改列标题的位置。所以我想效仿它。我想我应该使用 webdrivers 方法。但我不明白是哪一种。

最佳答案

这听起来像是 dragAndDrop() browser action 的一个很好的用例:

browser.actions().
dragAndDrop(elm, {x: 400, y: 20}).
perform();

您还可以从一个元素拖放到另一个元素:

browser.actions().
dragAndDrop(elm, targetElm).
perform();

而且,仅供引用,这是规范:

/**
* Convenience function for performing a "drag and drop" manuever. The target
* element may be moved to the location of another element, or by an offset (in
* pixels).
* @param {!webdriver.WebElement} element The element to drag.
* @param {(!webdriver.WebElement|{x: number, y: number})} location The
* location to drag to, either as another WebElement or an offset in pixels.
* @return {!webdriver.ActionSequence} A self reference.
*/
webdriver.ActionSequence.prototype.dragAndDrop = function(element, location) {
return this.mouseDown(element).mouseMove(location).mouseUp();
};

关于javascript - Protractor :如何拉伸(stretch)和替换元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31566765/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com