How to assert integer value in Selenium?
Given the html of a page.
. How can I find the element as shown in the pic and assert the value 1? First of all, it's better to use the @FindBy annotation to find elements. So if your class is, for example: col-xs-12 you can use: WebElement myElement = (WebElement)driver.findElement(By.className("col-xs-12"));
This way, it will automagically go searching for elements with the specified class, regardless of where on the screen they are placed. Then, to actually get the
//assert that we have the correct value inside this field. AssertEquals(1, input.getAttribute("value")); //get the image that needs to be clicked. WebElement image = (WebElement)driver.findElement(By.id("imageId"));
//get the anchor, or the link that goes "back" to the previous page. WebElement link = (WebElement)driver.findElement(By.linkText("Back to previous page"));
//go back to the previous page. Driver.navigate().back();
//now click the back button
Related Answers
How can we use the Selenium tool with HeadSpin?
Selenium is a tool that is used to automate functional testing. There are two types...
What are 5 Uses of Selenium?
Selenium is a web-automation tool that helps you to test web applications....
Whats the focus of this Selenium Certification Training?
You can learn it in a week. You just have to know the basics about what we...
