简体   繁体   中英

How select an item from the drop-down list without using scrolling and simulate user activity - Drag in TestCafe Studio?

I use Testcafe Studio to write tests.

There is a long drop-down list with elements. The item to select is out of view. Interested in how you can implement its selection without using scrolling (without using the built-in On-Page Actions: Drag). Maybe you can somehow implement it using functions or a script?

Specific task: in this form ( https://www.devexpress.com/Support/Center/Question/Create ) there is a drop-down list of the "Platform/Category:" field. Using TestCafe Studio, I need to write a test that selects the value "Native" from the list without using horizontal scrolling. Thanks.

try creating a function like this,

async selectDropDown(dropDownEle, valueToSelect){    
        await t.click(dropDownEle);
        await t.click(await dropDownEle.find('option[title="' + valueToSelect +'"]'));
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM