Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

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"));

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.

So, the question is - is there a simple technique I can use to find out if a WebElement / DOM has a class specified?

1 Answer

0 votes
by (62.9k points)

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.

Browse Categories

...