如何检查是否有DOM使用的webdriver(硒2)一类? [英] How to check if dom has a class using WebDriver (Selenium 2)?
问题描述
我很新的硒,所以我道歉,如果这是一个愚蠢的问题。
我已经成功地接线的IntelliJ(玩!框架)与硒,并创造使用firefoxDrivers一些测试。
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 firefoxDrivers.
我想检查页面已经被正确验证。
I'm trying to check if the page had been validated properly.
长话短说,我选择一个元素是这样的:
long story short, I'm selecting an element like this:
WebElement smallDecel = firefoxDriver.findElement(By.cssSelector("#configTable tr:nth-child(2) td .playerDecelInput"));
我做一些进一步的操作(清零并改变数值,提交形式),然后我要检查是否输入坐在TD被给另一个类。
I do some further operations (clear and change the value, submit the 'form'), and then I want to check if the TD the input sits in was given another class.
所以,问题是 - 有一个简单的方法,我可以用它来找出是否WebElement / DOM都指定一个类
So, the question is - is there a simple technique I can use to find out if a WebElement / DOM has a class specified?
推荐答案
您可以使用 FindElement(By.ClassName(//你的类名));
我会建议您将遍历并搜索的一段时间内的DOM或设置一个视频下载(XXXX),然后寻找附加类。
You can use FindElement(By.ClassName(//name of your class));
I would recommend that you either loop through and search the DOM for a set period of time or set a Thread.sleep(xxxx) and then look for the appended class.
这篇关于如何检查是否有DOM使用的webdriver(硒2)一类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!