柴和摩卡-如何在元素上测试鼠标

时间:2019-10-10 17:06:23

标签: typescript mocha chai

我正在使用chai&mocha测试网站。我知道他们有click()用于单击事件,但是是否有一个用于鼠标悬停?我尝试了focus()和hover(),但是没有成功。我收到此错误:

error TS2339: Property 'focus' does not exist on type 'Element'.

html是

    private liElm =
        '//*[@id="test"]/div/div[2]/div[2]/div/div[1]/div/div/a/span'

    assertX(): void {
        $(this.liElm).focus()
        //lets hover and check if otherElm div is displayed
        expect($(this.otherElm).isDisplayed()).to.be.true
    }

任何帮助将不胜感激。谢谢。

0 个答案:

没有答案