In my earlier posts, we have learnt few BASIC ACTION COMMANDS of selenium WebDriver software testing tool with examples. You will have to use them on daily basis for you software web application's webdriver test case preparation. It is very important for you to use them on right time and right place. Now let we learn 3 more action commands of webdriver.
1. driver.navigate().to
If you wants to navigate on specific software web application page or URL in between your software test then you can use driver.navigate().to command as bellow.
driver.navigate().to("http://only-testing-blog.blogspot.com/2014/01/textbox.html");
2. driver.navigate().back();
This command is useful to go back on previous page. Same as we are clicking browser back button. You can use this command as bellow. In Selenium IDE software testing tool, we can use "goBack" to perform same action.
driver.navigate().back();
3. driver.navigate().forward();
Same as we are clicking on forward button of browser.
Bellow given example will cover all three commands. Execute it in your eclipse to know them practically.
@Test
public void test () throws InterruptedException
{
driver.navigate().to("http://only-testing-blog.blogspot.com/2014/01/textbox.html");
//To navigate back (Same as clicking on browser back button)
driver.navigate().back();
//To navigate forward (Same as clicking on browser forward button)
driver.navigate().forward();
}
Thanks for the useful post.
ReplyDeletesir plz send me example of radio button and check box button in selenium in java....plz.....i take example of http://www.spicejet.com/
ReplyDeleteKomal Thakkar you can you Xpath absolute your given site url i had check and you radio button xpath is
ReplyDeletedriver.findElemnt(By.xpath("/html/body/form/div[4]/div[2]/div/div[4]/div[2]/div[1]/div[2]/div[2]/div/div[1]/table/tbody/tr/td[2]/input")).clik();