TestNG @Test attributes – AlwaysRun

alwaysRun is a testNG attribute which makes a test method run always even if it’s dependent method is not run… let’s see the code implementation public class AlwaysRun { WebDriver driver; @Test public void test1() { driver = new FirefoxDriver(); driver.get(“http:qavalidation.com”); Assert.assertTrue(driver.getTitle().contains(“Testing”)); } @Test(dependsOnMethods = {“test1”}, alwaysRun=true) public void test2() { driver.findElement(By.linkText(“Selenium Tutorial!”)).click(); } }…

testNG @Test attributes

TestNG framework provides some more features with the @Test to customise execution of test methods To know basics about the @Test, see the testng annotation. Attributes are: description: The description for this method.groups: The list of groups this class/method belongs to. Refer description and grouping testcases priority: The priority for this test method. Lower priorities will be…

Handling iframes in selenium

There are situations where web controls/elements reside inside an inline frame, the inline frame is another document or dom resides inside current HTML document. iframe can be represented in html as tag name=”iframe”. Elements inside an iframe can not be accessed as normal selenium statement – driver.findelement(By…) need to use, driver.switchTo().frame(…); In selenium, how we…

Handling RadioButtons in selenium

On a webpage, user can only selects one option from many of the limited group of options. In HTML we can represent a radio button with tag name “input” and attribute type=”radio”. Let’s see the code implementation package controls; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class Radiobuttons { public static…