如何在硒中的鼠标悬停在鼠标上检查工具提示消息?
我想通过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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用标题的归类值,然后您将获得工具提示文本。您不必滚动到元素。
期待(元素(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");