目前,我在从工具提示菜单返回内部文本甚至链接时遇到问题,该菜单在我将鼠标悬停在链接上后显示。使用开发工具,我看到这个链接和悬停菜单出现在标记为alphabetTooltip的Div中。如果我的方向是正确的,有人能告诉我吗?
public void get_All_Carousel_Cards_ofAlphabet() {
//Mouse.Click(CarouselLinks);
Mouse.Hover(CarouselLinks);
HtmlDiv tooltipdiv = new HtmlDiv();
tooltipdiv.SearchProperties[HtmlDiv.PropertyNames.Class] = "alphabetTooltip";
HtmlControl controls = new HtmlControl();
controls.SearchProperties.Add(HtmlControl.PropertyNames.ClassName, "HtmlHyperlink");
UITestControlCollection collection = controls.FindMatchingControls();
foreach (UITestControl links in collection)
{
//cast the item to html hyperlink typ
HtmlHyperlink mylinks = (HtmlHyperlink)links;
//get the innertext from the link, which inturn returns the link value itself
carousel_innerText = mylinks.InnerText;
}
}发布于 2015-02-23 16:01:50
尝试将工具提示添加为超链接搜索的父级,如下所示:
HtmlDiv tooltipdiv = new HtmlDiv();
tooltipdiv.SearchProperties[HtmlDiv.PropertyNames.Class] = "alphabetTooltip";
HtmlControl controls = new HtmlControl(tooltipdiv);https://stackoverflow.com/questions/28667920
复制相似问题