Setup Menus in Admin Panel

ITeLearn.com

ITeLearn Video FAQ’s Selenium

Videos – FAQ Document

This document is a quick FAQ document for all users of ITeLearn’s training program and videos.

1. I am able to login in ITeLearn.com. I can also see the respective training video links and the corresponding videos.However I am having issues playing the videos.
a. The 1st step is to ensure that you have the latest version of Microsoft Silverlight. Visit http://www.microsoft.com/getsilverlight/GetStarted/Install/Default.aspx to install the latest version. This will help to better streams.
b. The best browser to play the videos is Google Chrome. You can download and install the latest version from https://www.google.com/chrome
c. Videos are based on secure streaming technology. Hence you need to provide some time for the videos to load completely. Post which you will be able to easily navigate through the video timeline (Pause, Rewind, Forward, Replay etc)

2. I am able to login to IteLearn.com. However I am unable to see any Quick Access links to the videos
a. This must have happened because you are not given access to the right membership level.
b. Email us immediately at learn@itelearn.com so that we can add you to the right ITeLearn membership level.

3. I am not able to download class files and scripts.
a. See if the Download option is active.
b. If its Inactive send a mail to learn@itelearn.com for help.
c. Class files are Zip files,they should be downloaded and saved on your system.
d. They can be accessed from the QTP /Selenium Tool.

4. I am unable to watch only specific videos .
a. Try to play them on a different browser and check.

5. I am having issues viewing the videos. It is taking almost 4-5 hours to view an hour of video. Also, the buffering stops in between and have to restart it.
a. Check if you have decent internet speed for faster streaming.
b. If the internet speed is fine.As a alternate play the videos on a different browser.

6. How to send email from your selenium webdriver test?
a. When you run your TCs through TestNG, a test-output folder is created, which contains a file with name emailable-report.html,so basically you need to send that file as an attachment to the stakeholders. Here I’ve considered the fact that your localhost is configured to send emails.

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendFileEmail
{
public static void main(String [] args)
{

// Recipient’s email ID needs to be mentioned.
String to = “abcd@gmail.com”;
// Sender’s email ID needs to be mentioned
String from = “web@gmail.com”;
// Assuming you are sending email from localhost
String host = “localhost”;
// Get system properties
Properties properties = System.getProperties();
// Setup mail server
properties.setProperty(“mail.smtp.host”, host);
// Get the default Session object.
Session session = Session.getDefaultInstance(properties);

try{
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress(from));
// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));

// Set Subject: header field
message.setSubject(“This is the Subject Line!”);

// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();

// Fill the message
messageBodyPart.setText(“This is message body”);

// Create a multipar message
Multipart multipart = new MimeMultipart();

// Set text message part
multipart.addBodyPart(messageBodyPart);

// Part two is attachment
messageBodyPart = new MimeBodyPart();
String filename = ““;
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);

// Send the complete message parts
message.setContent(multipart );

// Send message
Transport.send(message);
System.out.println(“Sent message successfully….”);
}catch (MessagingException mex) {
mex.printStackTrace();
}
}
}

7.How to manage cross browser testing in selenium webdriver?
a. import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.ie.InternetExplorerDriver;

import org.testng.annotations.AfterClass;

import org.testng.annotations.BeforeClass;

import org.testng.annotations.Parameters;

import org.testng.annotations.Test;

public class MultiBrowser {

public WebDriver driver;

@Parameters(“browser”)

@BeforeClass

// Passing Browser parameter from TestNG xml

public void beforeTest(String browser) {

// If the browser is Firefox

if(browser.equalsIgnoreCase(“firefox”)) {

driver = new FirefoxDriver();

// If browser is IE

}else if (browser.equalsIgnoreCase(“ie”)) {

// path for IEDriver

System.setProperty(“webdriver.ie.driver”, “D:\IEDriverServer.exe”);

driver = new InternetExplorerDriver();

}

driver.get(“http://www.atomic77.com/itelearnnew2”);

}

// Test method

@Test public void login() throws InterruptedException {

driver.findElement(By.xpath(“//*[@id=’single-post’]/div[2]/div[2]/div[1]/a”)).click();

driver.findElement(By.xpath(“//*[@id=’user_login’]”)).sendKeys(“dummyuser”);

driver.findElement(By.xpath(“//*[@id=’user_pass’]”)).sendKeys(“user12”);

driver.findElement(By.xpath(“//*[@id=’wp-submit’]”)).click();

}

@AfterClass public void afterTest() {

driver.quit();

}

}
8.Drag and Drop action in Webdriver?
a. Lets take an example of the site ‘http://jqueryui.com/droppable’

import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;

public class JqueryElements {

public static void main(String[] args) {

WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(“http://jqueryui.com/droppable/#default”);
driver.manage().window().maximize();

Actions act = new Actions(driver);

// Script for dragging an element and dropping it in another place
WebElement iFrame = driver.findElement(By.tagName(“iframe”));
System.out.println(iFrame.getSize());
driver.switchTo().frame(iFrame);

WebElement From = driver.findElement(By.id(“draggable”));
System.out.println(From.getLocation());

WebElement To = driver.findElement(By.id(“droppable”));
System.out.println(To.getLocation());

act.dragAndDrop(From, To).build().perform();

}
}

9. How to take a screenshot of an element using Selenium WebDriver?
a. WebDriver driver = new FirefoxDriver();
driver.get(“http://www.google.com/”);
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example copy somewhere
FileUtils.copyFile(scrFile, new File(“c:\\tmp\\screenshot.png”));

10. How to time your tests in selenium
a. final long startTime = System.currentTimeMillis();
for (int i = 0; i < length; i++) { // Do something } final long endTime = System.currentTimeMillis(); System.out.println("Total execution time: " + (endTime - startTime) ); 11. How to retrieve a specific cell value from a web table using Selenium WebDriver
a. Here in this example i covering how to retrieve a specific cell value from Web Table using Selenium WebDriver:

The below code works well if the Cell contains plain text than any other controls etc.

int rownum,colnum;
String s_xpath;

WebDriver driver=new FirefoxDriver();
driver.get(“https://www.irctc.co.in/”);

rownum=2;
colnum=1;
//Here i am framing the xpath with rownum and colnum
s_xpath=”//*[@id=’tabslinks’]/tbody/tr[“+rownum+”]/td[“+colnum+”]”;

//getText method retrieves the cell value.
System.out.println(driver.findElement(By.xpath(s_xpath)).getText());

12. How to close a dialog box using Selenium WebDriver
a. There might be places, when you click on an object a dialog will pop up asking your conformation. How to close those kind of alert messages?

The below code help you to close any such alert boxes.

import org.openqa.selenium.Alert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class PopupDialog
{
public static void main(String[] args)
{
WebDriver driver=new FirefoxDriver();
driver.get(“http://www.agoda.com/?ymsg=1&tick=634955861691”);

Alert alt=driver.switchTo().alert();
alt.accept();
}
}

13. How to work with FireFox profiles?
a. ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile(“profile1”);
WebDriver driver = new FirefoxDriver(myprofile);

14. How to work with FireFox profile?
a. Creating New Profile:
1. Close FF browser, open task manager and kill FF instance.
2. Open Run window using window key + R Key.
3. Type firefox.exe -p
4. Choose user profile dialog will open.

If it still does not open then you may need to specify the full path of the Firefox program, enclosed in quotes; for example

  • On 32-bit Windows: “C:Program FilesMozilla Firefoxfirefox.exe” -p
  • On 64-bit Windows: “C:Program Files (x86)Mozilla Firefoxfirefox.exe” -p

5. Create new profile, and give desired name.
6. Click on the ‘Start Firefox’ box. Firefox will start with the new profile.

Note: You will notice that the new Firefox window will not show any of your Bookmarks and Favorite icons.
Note: The last selected profile will then start automatically when you next start Firefox and you will need to start the Profile Manager again to switch profiles.

7.Once the Automation Profile is created, it needs to be called in the Test scripts. You can now add the below code to your Test scripts to Instantiating the Firefox Driver:

January 2, 2013

0 Responses on ITeLearn Video FAQ's Selenium"

Main Menu