Automation Script Implementation in Webdriver:
Let’s know, how to do Automation Script Implementation in Webdriver in Eclipse by using Java. Here in this article, I have implemented a Selenium Webdriver automation script of Practice form to fill for the purpose of Practice for Automation Testing.
In this script, I have taken Project Name: Selenium Automation, Package name: Practice, Classname: Webdriver_Practice
In this script I have used to automate Text boxes, dropdown, Multiple options select in List box, Button, Radio button, Checkbox, Image path for upload, parameterization, Google chrome browser launch etc.
package Practice.Practice;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Webdriver_Practice {
public WebDriver driver;
public void Chrome_Launch() {
System.setProperty(“webdriver.chrome.driver”, “D:\\Selenium\\Library\\chromedriver.exe”);
driver=new ChromeDriver();
}
public void Url_0pen() {
driver.manage().window().maximize();
driver.get(“http://toolsqa.com/automation-practice-form/”);
}
public void Practice_Automation_Form(){
driver.findElement(By.partialLinkText(“Partial Link Test”)).click(); //click on Partial Link Test driver.findElement(By.xpath(“/html/body/div[1]/div[5]/div[2]/div/div/div[1]/div/div/div/div[2] /div/form/fieldset/div[8]/input”)).sendKeys(“Test”); //Enter First Name
driver.findElement(By.xpath(“/html/body/div[1]/div[5]/div[2]/div/div/div[1]/div/div/div/div[2] /div/form/fieldset/div[11]/input”)).sendKeys(“Name1”); //Enter Last Name
driver.findElement(By.id(“sex-0”)).click(); // Select the Sex as Male
driver.findElement(By.id(“exp-3”)).click(); // Select the Years of Experience
driver.findElement(By.id(“profession-0”)).click(); // click on check box of Profession as Manual Tester
driver.findElement(By.id(“profession-1”)).click(); // click on check box of Profession as Automation Tester
driver.findElement(By.id(“photo”)).sendKeys(“C:\\Users\\Public\\Pictures\\Sample Pictures\\test.jpg”); // This line of code will upload the Profile pic from the Local system drive
new Select(driver.findElement(By.id(“continents”))).selectByVisibleText(“Australia”); // This line of code is for Select the value from a dropdown field.
}
/*This below method is to select multiple options in a Listbox or dropdown */
public void Select_Multiple_Options_In_Listbox(){
WebElement Groupid_select=driver.findElement(By.id(“selenium_commands”));
Select group=new Select(Groupid_select);
group.selectByVisibleText(“Browser Commands”);
group.selectByVisibleText(“Navigation Commands”);
group.selectByVisibleText(“Wait Commands”);
}
public void Submit_Form(){
driver.findElement(By.id(“submit”)).click(); // click on the Submit button
driver.close();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Webdriver_Practice d=new Webdriver_Practice();
d.Chrome_Launch();
d.Url_0pen();
d.Practice_Automation_Form();
d.Select_Multiple_Options_In_Listbox();
d.Submit_Form();
}
}
Please click here to Read Browser Launch in Selenium Webdriver
Please click here to Read X-path through Firebug and FirePath
24 Comments
Hairstyles
I have observed that in the world of today, video games are classified as the latest rage with children of all ages. There are occassions when it may be impossible to drag your children away from the games. If you want the best of both worlds, there are several educational video games for kids. Thanks for your post.
Hairstyles
My spouse and I absolutely love your blog and find most of your post’s to be just what I’m looking for. Do you offer guest writers to write content for yourself? I wouldn’t mind creating a post or elaborating on a few of the subjects you write regarding here. Again, awesome blog!
Hairstyles
Can I just say what a reduction to find somebody who really is aware of what theyre speaking about on the internet. You definitely know learn how to bring a difficulty to light and make it important. Extra folks must learn this and perceive this side of the story. I cant believe youre no more fashionable since you definitely have the gift.
red bottom shoes
I must express some appreciation to the writer just for rescuing me from such a trouble. Right after checking through the the web and obtaining advice which are not beneficial, I was thinking my life was done. Being alive without the presence of strategies to the problems you have resolved by way of your article content is a serious case, as well as the ones which might have adversely damaged my entire career if I had not come across your blog. Your main mastery and kindness in maneuvering all the pieces was valuable. I’m not sure what I would’ve done if I had not come upon such a step like this. I’m able to at this moment relish my future. Thanks so much for your specialized and result oriented help. I won’t hesitate to endorse your blog to any individual who would like guidance about this subject.
WimWeard
zoloft price generic
curry 4
I’m also writing to let you know of the magnificent experience our child encountered studying the blog. She noticed many issues, most notably what it’s like to possess a great coaching heart to have certain people with ease thoroughly grasp various extremely tough things. You truly did more than our own desires. Many thanks for churning out the useful, dependable, informative and in addition easy tips on that topic to Lizeth.
nike vapormax
I simply wished to say thanks again. I do not know what I might have carried out without these creative ideas provided by you about my area of interest. It had become a very terrifying dilemma in my position, however , coming across the very expert tactic you treated it made me to cry over fulfillment. Now i’m happier for your support as well as hope you realize what an amazing job you happen to be accomplishing educating many others by way of your blog. I am sure you have never come across any of us.
WimWeard
where can i buy vermox
kobe 11
A lot of thanks for all of the efforts on this web site. My mother really likes conducting investigations and it’s really easy to see why. We learn all of the lively method you make reliable tricks through your web site and in addition encourage participation from website visitors on the concern while our favorite child is undoubtedly studying a great deal. Have fun with the remaining portion of the new year. Your carrying out a glorious job.
WimWeard
triamterene-hctz 75-50 mg
supreme clothing
I definitely wanted to develop a brief comment to thank you for all of the nice tips and hints you are placing at this website. My time-consuming internet look up has at the end of the day been honored with good facts to share with my partners. I would express that many of us site visitors actually are unequivocally lucky to exist in a remarkable community with very many perfect people with beneficial basics. I feel quite fortunate to have used your web pages and look forward to so many more amazing times reading here. Thank you again for all the details.
kyrie 3
I simply had to say thanks all over again. I am not sure what I would’ve followed in the absence of the entire tactics discussed by you directly on such theme. It had been the depressing condition for me, nevertheless viewing the expert technique you dealt with that made me to leap over contentment. I’m grateful for your information and even trust you know what a powerful job you happen to be providing educating some other people through a web site. I know that you have never come across all of us.
WimWeard
albendazole over the counter uk
jordan shoes
I really wanted to send a simple message so as to appreciate you for those precious items you are placing at this website. My rather long internet investigation has now been paid with useful concept to exchange with my close friends. I ‘d tell you that many of us site visitors actually are undeniably blessed to live in a perfect website with many brilliant professionals with very helpful tips. I feel very much privileged to have discovered your web page and look forward to really more pleasurable moments reading here. Thank you once more for a lot of things.
WimWeard
paxil tablets in india
moncler
I am just commenting to let you understand of the great experience my wife’s daughter gained studying your site. She figured out many pieces, with the inclusion of how it is like to have an incredible giving character to get others completely comprehend chosen hard to do issues. You truly exceeded our expected results. Many thanks for supplying such priceless, healthy, explanatory and as well as unique guidance on this topic to Janet.
Nike Shoes
[url=http://www.airmax97.us.com/][b]Air Max 97[/b][/url]
[url=http://www.max270.us.com/][b]Nike Air Max 270[/b][/url]
[url=http://www.supplyyeezy.us.com/][b]Yeezy Supply[/b][/url]
[url=http://www.kobebryant-jersey.us/][b]Kobe Bryant Jersey[/b][/url]
[url=http://www.kobebryantjerseysforsale.us/][b]Kobe Bryant Jerseys For Sale[/b][/url]
[url=http://www.kobebryantjersey24.us/][b]Kobe Bryant Jersey 24[/b][/url]
[url=http://www.kobebryantwebsiteofficial.us/][b]Kobe Bryant Website Official[/b][/url]
[url=http://www.yeezy-shoe.us.com/][b]Yeezy[/b][/url]
[url=http://www.yeezymafia.us.com/][b]Yeezy[/b][/url]
[url=http://www.nikes.us.com/][b]Nike Shoes[/b][/url]
[url=http://www.nikeshoes.us.org/][b]Nike Shoes[/b][/url]
[url=http://www.nfl-jerseys.us.org/][b]NFL Jerseys[/b][/url]
[url=http://www.yeezyboost350.us.com/][b]Yeezy Boost 350[/b][/url]
[url=http://www.yeezy.com.co/][b]Yeezy Shoes[/b][/url]
[url=http://www.nikeoutletstoreonlineshopping.us/][b]Nike Outlet[/b][/url]
[url=http://www.yeezy380.us/][b]Yeezy 380[/b][/url]
[url=http://www.yeezy380.us.com/][b]Yeezy 380[/b][/url]
[url=http://www.nikefactory.us.com/][b]Nike Outlet[/b][/url]
[url=http://www.humanraces.us.com/][b]Human Races[/b][/url]
[url=http://www.humanracesshoes.us/][b]Human Race Shoes[/b][/url]
[url=http://www.basketball-jerseys.us.com/][b]Basketball Jerseys[/b][/url]
[url=http://www.jerseysbasketball.us/][b]Basketball Jerseys[/b][/url]
[url=http://www.jerseys-nba.us/][b]Cheap NBA Jerseys[/b][/url]
[url=http://www.nikes-shoes.us.com/][b]Nike Outlet[/b][/url]
[url=http://www.yeezy-shoe.us.com/][b]Yeezy Shoes[/b][/url]
[url=http://www.yeezymafia.us.com/][b]Yeezy Mafia[/b][/url]
[url=http://www.yeezy350v2.us/][b]Yeezy 350 V2[/b][/url]
[url=http://www.yeezysofficialsite.us/][b]Yeezys Official Site[/b][/url]
[url=http://www.yeezyslides.us/][b]Yeezy sliders[/b][/url]
[url=http://www.jerseys-nba.us.com/][b]NBA Jerseys[/b][/url]
[url=http://www.jerseysnba.us.com/][b]NBA Jerseys[/b][/url]
[url=http://www.airjordan-1.us/][b]Air Jordan 1[/b][/url]
[url=http://www.airjordan1.us.com/][b]Air Jordan 1[/b][/url]
[url=http://www.jordan-1.us.com/][b]Jordan 1[/b][/url]
[url=http://www.jordan1s.us.com/][b]Jordan 1s[/b][/url]
[url=http://www.jordan1s.us/][b]Jordan 1s[/b][/url]
[url=http://www.retrojordan.us.com/][b]Jordan Retro[/b][/url]
[url=http://www.jordanretro4.us.com/][b]Jordan Retro 4[/b][/url]
[url=http://www.jordan4-retro.us/][b]Jordan 4 Retro[/b][/url]
[url=http://www.jordansshoess.us.com/][b]Jordans Shoes[/b][/url]
[url=http://www.jordan4s.us/][b]Jordan 4s[/b][/url]
[url=http://www.diorjordan1.us/][b]Dior Jordan 1[/b][/url]
[url=http://www.airjordan1mid.us/][b]Air Jordan 1 Mid[/b][/url]
[url=http://www.jordan11concord.us/][b]Jordan 11 Concord[/b][/url]
[url=http://www.jordan11retro.us/][b]Jordan 11 Retro[/b][/url]
[url=http://www.jordan1low.us/][b]Jordan 1 Low[/b][/url]
[url=http://www.jordan11s.us/][b]Jordan 11s[/b][/url]
[url=http://www.jordanaj1.us/][b]Jordan AJ 1[/b][/url]
[url=http://www.nbastores.us/][b]NBA Store[/b][/url]
[url=http://www.nbaoutletstore.us/][b]NBA Store[/b][/url]
[url=http://www.yeezystore.us.com/][b]Yeezy[/b][/url]
[url=http://www.yeezyssneakers.us.com/][b]Yeezy Sneaker[/b][/url]
[url=http://www.adidasyeezyofficialwebsite.com/][b]Adidas Yeezy Official Website[/b][/url]
[url=http://www.adidasyeezyonlinestore.us/][b]Adidas Yeezy Online Store[/b][/url]
[url=http://www.airmaxclearancesale.us/][b]Air Max Clearance Sale[/b][/url]
[url=http://www.nflshopofficialonlinestore.com/][b]NFL Shop Official Online Store[/b][/url]
[url=http://www.nikeuk.uk.com/][b]Nike UK[/b][/url]
[url=http://www.yeezy.uk.com/][b]Yeezy[/b][/url]
[url=http://www.yeezy350.uk.com/][b]Yeezy 350[/b][/url]
[url=http://www.adidasyeezy.uk.com/][b]Adidas Yeezy[/b][/url]
yeezy 700
There may be noticeably a bundle to know about this. I assume you made certain nice factors in options also.
golden goose
You made some decent factors there. I seemed on the internet for the difficulty and found most people will associate with together with your website.
golden goose sneakers
I抎 need to examine with you here. Which is not one thing I normally do! I get pleasure from studying a submit that will make people think. Additionally, thanks for allowing me to remark!
WimWeard
bactrim cream otc
golden goose outlet
very good post, i actually love this web site, carry on it
WimWeard
albenza prescription drug
off white clothing
It抯 onerous to seek out knowledgeable people on this subject, however you sound like you know what you抮e speaking about! Thanks