我使用 Testcafe。 我在点击导航栏底部的元素时遇到问题。
测试网址:https://devexpress.github.io/testcafe/documentation/test-api/
测试代码:
import {Selector} from 'testcafe'
fixture('scroll')
test('Can scroll sidebar', async t => {
await t
.navigateTo('https://devexpress.github.io/testcafe/documentation/test-api/')
.resizeWindow(1280, 600)
.click(Selector('a').withText('TypeScript Support'))
})
我想要滚动导航栏并单击 TypeScript Support
链接,但滚动的是整个窗口,而不是导航栏。这里有解决方法吗?
最佳答案
导航菜单使用自定义滚动机制,因此自动滚动机制不应该工作。
您应该使用 the drag action 手动滚动到所需的菜单项。 ,例如:.drag('.ps-scrollbar-y', 0, 600)
。
关于testing - 无法滚动导航菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53575914/