Selenium webdriver(javascript)标签

时间:2016-05-23 13:45:55

标签: selenium-webdriver

在填写表格时,测试需要标签以便转到下一个字段。

我得到的错误是:

 InvalidArgumentError: Not a modifier key

代码:

var key = require('selenium-webdriver').Key;
var actionSequence = require('selenium-webdriver').ActionSequence;

    new actionSequence(driver).keyDown(key.CONTROL).keyDown(key.TAB).perform().then(function(){
    console.log("Done selection?");
});

1 个答案:

答案 0 :(得分:2)

mynamespace { public class ExpandableHeightGridView :GridView { bool _isExpanded = false; public ExpandableHeightGridView (Context context) : base (context) { } public ExpandableHeightGridView (Context context, IAttributeSet attrs) : base (context, attrs) { } public ExpandableHeightGridView (Context context, IAttributeSet attrs, int defStyle) : base (context, attrs, defStyle) { } public bool IsExpanded { get { return _isExpanded; } set { _isExpanded = value; } } protected override void OnMeasure (int widthMeasureSpec, int heightMeasureSpec) { if (IsExpanded) { int expandSpec = MeasureSpec.MakeMeasureSpec (View.MeasuredSizeMask, MeasureSpecMode.AtMost); base.OnMeasure (widthMeasureSpec, expandSpec); var layoutParameters = this.LayoutParameters; layoutParameters.Height = this.MeasuredHeight; } else { base.OnMeasure (widthMeasureSpec, heightMeasureSpec); } base.OnMeasure(widthMeasureSpec, heightMeasureSpec); } } } 操作仅适用于修饰键:

keyDown

要发送标签键,请使用key.CONTROL key.SHIFT key.ALT key.COMMAND

.sendKeys