import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import com.thoughtworks.selenium.*;
import org.openqa.selenium.server.*;
import org.testng.annotations.*;
public class Dropdowngoogle {
public Selenium selenium;
public SeleniumServer seleniumserver;
@BeforeClass
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://");
seleniumserver.start();
selenium.start();
}
@Test
public void testDropdowngoogle()throws Exception {
selenium.open("http://www.google.com");
//click on Advanced Search Window
selenium.click("link=Advanced Search");
selenium.waitForPageToLoad("5000");
//Print all the available options from the results dropdown in the google advanced search page
String[] option = selenium.getSelectOptions("name=lr");
//The above command returns a array of strings(options)
//write results to excel and note pad
File file = new File("C:/Dropdownvalues.xls");//excel
File file1 = new File("C:/Dropdownvalues.txt");//notepad
BufferedWriter out = new BufferedWriter(new FileWriter(file));//excel
BufferedWriter out1 = new BufferedWriter(new FileWriter(file1));//notepad
out.write("Options in drop down\n");//Excel
out1.write("Options in drop down\n");//notepad
for (int i = 0; i < option.length; i++) {
System.out.println("Option: " + i + " is" + option[i]);
out.write(""+option[i]);
out.newLine();
out1.write(""+option[i]);
out1.newLine();
}
out.close();//excel
out1.close();//notepad
}
@AfterClass
public void tearDown()throws Exception {
selenium.stop();
seleniumserver.stop();
}
}
This technical post helps me to improve my skills set, thanks for this wonder article I expect your upcoming blog, so keep sharing...
ReplyDeleteSelenium Training in Chennai|Selenium Training
And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.
ReplyDeleteselenium training in chennai
I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
ReplyDeleteBest Java Training Institute Chennai
Amazon Web Services Training in Chennai
Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
ReplyDeleteHadoop Training in Chennai
Amazing Post. The choice of words is very unique. Interesting idea. Looking forward for your next post.
ReplyDeleteHadoop Admin Training in Chennai
Hadoop Administration Training in Chennai
Hadoop Administration Course in Chennai
Hadoop Administration Training
Big Data Administrator Training
IELTS coaching in Chennai
IELTS Training in Chennai
SAS Training in Chennai
SAS Course in Chennai
Amazing work. Extra-ordinary way of capturing the details. Thanks for sharing. Waiting for your future updates.
ReplyDeleteSpoken English Classes in Chennai
Best Spoken English Classes in Chennai
Spoken English Class in Chennai
Spoken English in Chennai
Node JS Training in Chennai
Node JS Course in Chennai
Node JS Advanced Training
Node JS Training Institute in chennai
You are an amazing writer. No words to describe your blog. Way to go.
ReplyDeleteXamarin Training in Chennai
Xamarin Course in Chennai
Xamarin Training Course
Xamarin Classes
Xamarin Training in Velachery
Xamarin Training in Tambaram
Xamarin Training in Anna Nagar
Great Article. Wonderful writing. You are an amazing author. Waiting for your future post.
ReplyDeleteIonic Training in Chennai
Ionic Course in Chennai
Ionic Training Course
Ionic Framework Training
Ionic Training near me
Ionic Training in Velachery
Ionic Training in Tambaram
Wonderful blog! Thanks for sharing this valuable information
ReplyDeleteGerman Classes in Chennai
German Classes in Bangalore
German Classes in Coimbatore
German Classes in Madurai
German Language Course in Hyderabad
German Language Course in Bangalore
German Courses in Bangalore
German classes in marathahalli
Tally Course in Bangalore
Ielts coaching in bangalore