How to check if dom has a class using WebDriver (Selenium 2)?

前端 未结 3 1129
忘掉有多难
忘掉有多难 2021-02-05 05:43

I am very new to Selenium, so my apologies if it\'s a silly question. I have successfully wired up IntelliJ (Play! framework) with Selenium, and created some tests using firefox

3条回答
  •  有刺的猬
    2021-02-05 06:12

    Once you find the element, you can just call myElement.GetAttribute("class"). Then you can parse the string that is returned and see if it contains or does not contain the class name you care about.

提交回复
热议问题