How to verify a Text present in the loaded page through WebDriver

前端 未结 8 850
眼角桃花
眼角桃花 2020-12-15 09:49

I need to verify a Text present in the page through WebDriver. I like to see the result as boolean (true or false). Can any one help on this by giving the WebDriver code?

8条回答
  •  半阙折子戏
    2020-12-15 10:28

    If you are not bothered about the location of the text present, then you could use Driver.PageSource property as below:

    Driver.PageSource.Contains("expected message");

提交回复
热议问题