Professional Documents
Culture Documents
http://docs.seleniumhq.org/download/
Below code is to launch IE.
System.setProperty(webdriver.ie.driver, E:\\Library\\IEDriverServer.exe);
driver=new InternetExplorerDriver();
driver.get(http://gmail.com);
28. Q. How to launch GoogleChrome
A.For GoogleChrome, We need the supported ChromeDriver exe file. Can be downloaded from the
below site:
http://code.google.com/p/chromedriver/downloads/list
Below code is to launch GoogleChrome
System.setProperty(webdriver.chrome.driver, E:\\Library\\chromedriver.exe);
driver=new ChromeDriver();
driver.get(http://gmail.com);
29. Q. Brief about the Disadvantages of Selenium
A.Selenium supports Web applications. It doesnt support Desktop applications
30. Q. How to handle Deskptop, Flex and Flash objects in Selenium.
A.We can use SIKULI as a add-on for Selenium to support Desktop, Flex and Flash objects
Sikuli is an open source automation tool developed on JAVA
Can be downloaded from:https://launchpad.net/sikuli/+download
31. Q. How to take data from excel(xls) file
A.FileInputStream fi=new FileInputStream(Path of the excel file);
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(0);
It will read the excel file upto the sheet. To take the data from sheet, use below command,
s.getCell(columnID, rowID).getContents())
ex: s.getCell(0, 1).getContents();
32. Q. How to create Excel file
A.FileOutputStream fo=new FileOutputStream(Path to create xls file);
WritableWorkbook wb=Workbook.createWorkbook(fo);
WritableSheet ws=wb.createSheet(Results, 0);
Label un=new Label(0,0,Username);
ws.addCell(un);
wb.write();
wb.close();
33. Q. How to print data from notepad(txt file)
A.File f=new File(E:\\data2.txt);
FileReader fr=new FileReader(f);
BufferedReader br=new BufferedReader(fr);
String str;
while((str=br.readLine())!=null)
{
System.out.println(str);
}
Thread.sleep(1000);
a.keyDown(Keys.CONTROL).sendKeys(Keys.HOME).build().perform();
a.keyDown(Keys.ALT).sendKeys(Keys.F1).build().perform();