I have a small luggage icon that displays a tooltip when you hover over the icon. I want to verify this by writing C # code in Visual Studio.
Here's how the luggage icon is displayed in html:
<div class="icon_png information icon_baggageyes" title="1 piece included in this fare."></div>
And here is my code for checking the tooltip:
Actions a = new Actions(driver); IWebElement tooTipObject = driver.FindElement(By.XPath("//div[@class='icon_png information icon_baggageyes']")); a.MoveToElement(tooTipObject).Click().Build().Perform();
The problem is that I am debugging the code above step by step, a tooltip text will appear. But when I run the test, the tooltip text now displays.
When searching the Internet, some people say that the reason is that the mouse does not focus on the baggage icon long enough for the tooltip to display.
But how to solve this problem? I was looking for solutions, but could not find one that works on mine.
And also my question: a.MoveToElement(tooTipObject).Click().Build().Perform(); tooltip text will only be displayed if I put .Click() in this code. But I check the mouse over the function, do not click on the icon. This is so strange.
source share