开发者

Watin Visible of Text

开发者 https://www.devze.com 2023-03-31 13:33 出处:网络
I\'m Using W开发者_Python百科atin tool in C# to find a text is available in webpage/URL. Using the code:

I'm Using W开发者_Python百科atin tool in C# to find a text is available in webpage/URL. Using the code:

bool flag =  browser.containsText("Some Text");

But returns true, but the text("Some Text") is hidden in page. I need to get only visible text of a URL. i Dont Have the ID/Name of the Element...


Find the control that is hidden and check to see if it is visible and contains the text.

Example if it were a Div and using NUnit:

Assert.IsTrue(myBrowser.Div.Style.GetAttributeValue("visibility") == "hidden" && myBrowser.Div("myPossiblyHiddenDiv").Text.Contains("the text"));

Lots of ways to check for the text; I usually try to go as granular as possible in case there are other controls on the page that contain the text in question.

0

精彩评论

暂无评论...
验证码 换一张
取 消