如何在硒中的鼠标悬停在鼠标上检查工具提示消息?

发布于 2025-02-07 15:28:12 字数 1237 浏览 3 评论 0原文

我想通过Tooltip执行鼠标函数,该功能显示出Meessage。

这是视频的链接 - https://screenrec.com/share/share/share/5iwwtd4a7i9

出于某些原因Hober没有发生我的文本和测试失败,

这是我尝试过的

browser.actions()
.mouseMove(
  element(by.xpath('/html/body/app-root/div/main/ng-component/ngb-tabset/div/div/view-concepts-tab/div[1]/concept-view/div/dl/mat-accordion/mat-expansion-panel/div/div/div[4]/term-view/div/div[3]/div[1]/dl/mat-accordion/mat-expansion-panel/mat-expansion-panel-header/span[1]/mat-panel-description/dd/span')))
.click()
.perform();

text('On mouse hover')

    expect(element.all(by.xpath('/html/body/app-root/div/main/ng-component/ngb-tabset/div/div/view-concepts-tab/div/concept-view/div/dl/mat-accordion/mat-expansion-panel/div/div/div[2]/term-view/div/div[3]/div[1]/dl/mat-accordion/mat-expansion-panel/mat-expansion-panel-header/span[1]/mat-panel-description/dd/span'))).toEqual('On mouse hover');

edit

我在以下代码方面取得了一些成功,但是错误是期望[] '鼠标悬停在。

    expect(element.all(by.css('dd#A>span'))).toEqual('On mouse hover');

I want to do mouseover function over Tooltip, which displays meessage.

Here is the link to video - https://screenrec.com/share/5IWTd4a7i9

For some reason hover does not happen due to which I do not get the text and test fails

This is what I have tried

browser.actions()
.mouseMove(
  element(by.xpath('/html/body/app-root/div/main/ng-component/ngb-tabset/div/div/view-concepts-tab/div[1]/concept-view/div/dl/mat-accordion/mat-expansion-panel/div/div/div[4]/term-view/div/div[3]/div[1]/dl/mat-accordion/mat-expansion-panel/mat-expansion-panel-header/span[1]/mat-panel-description/dd/span')))
.click()
.perform();

text('On mouse hover')

Also tried

    expect(element.all(by.xpath('/html/body/app-root/div/main/ng-component/ngb-tabset/div/div/view-concepts-tab/div/concept-view/div/dl/mat-accordion/mat-expansion-panel/div/div/div[2]/term-view/div/div[3]/div[1]/dl/mat-accordion/mat-expansion-panel/mat-expansion-panel-header/span[1]/mat-panel-description/dd/span'))).toEqual('On mouse hover');

EDIT

I got some success with below code, however error is Expected [ ] to equal 'On mouse hover'.

    expect(element.all(by.css('dd#A>span'))).toEqual('On mouse hover');

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隱形的亼 2025-02-14 15:28:12

您必须使用标题的归类值,然后您将获得工具提示文本。您不必滚动到元素。

期待(元素(by.id(“ xyz”))。getAttribute(“ title”))。tobe(“工具提示文本”);

You have to use atribute value of title then you will get the tooltip text. you dont have to scroll to the element.

expect(element(By.id("xyz")).getAttribute("title")).ToBe("Tool tip text");

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文