开发者

Write Selenium Test to test text wrapping?

I am trying 开发者_开发问答to write the selenium test using selenium 2.0 for the attached scenario.

Write Selenium Test to test text wrapping?

HTML code is as follows

<div width="100px" style = "background-color:blue"> This%is%Normal%Text%on%page%without%dynamic%view%and%not%width%set. </div>

I need to verify whether text is wrapping or not. Text should wrap in the 2nd scenario

Any help would be appreciated.

Thanks, Sahil


I'm afraid it goes too deep to browser's internals so it is not possible with Selenium. Maybe you can check the height ow wrapping element (div) if it exceeds height of line, but it looks fragile to me.


May be should try the url encode/uncode to see if that particular text is encoded or not?


You can check if the text is overflowed.

public boolean isElementOverflowed(CoreLocator element) {
    return (boolean) coreDriver.executeScript("return arguments[0].scrollWidth > arguments[0].clientWidth",
            element.getWebElement());
}

and call it in your code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜