Showing posts with label selenium rc. Show all posts
Showing posts with label selenium rc. Show all posts

Friday, October 5, 2012

Selenium RC vs WebDriver

Selenium RC (Selenium 1):
Selenium uses JavaScript to automate web pages. This lets it interact very tightly with web content, and was one of the first automation tools to support Ajax and other heavily dynamic pages. However, this also means Selenium runs inside the JavaScript sandbox. This means you need to run the Selenium-RC server to get around the same-origin policy, which can sometimes cause issues with browser setup.

WebDriver (Selenium 2):

WebDriver on the other hand uses native automation from each language. While this means it takes longer to support new browsers/languages, it does offer a much closer ‘feel’ to the browser. If you’re happy with WebDriver, stick with it, it’s the future. There are limitations and bugs right now, but if they’re not stopping you, go for it.

Selenium Benefits over WebDriver
  • Supports many browsers and many languages, WebDriver needs native implementations for each new languagte/browser combo.
  • Very mature and complete API
  • Currently (Sept 2010) supports JavaScript alerts and confirms better
Benefits of WebDriver Compared to Selenium
  • Native automation faster and a little less prone to error and browser configuration
  • Does not Requires Selenium-RC Server to be running
  • Access to headlessHTMLUnit can allow really fast tests
  • Great API

Thursday, July 26, 2012

selenium screenshots using webdriver

Taking Screenshots with Selenium WebDriver

Take a screenshot with Selenium WebDriver

Testers do take screenshots while testing, its important in many ways. So can you take screenshots using Selenium WebDriver? The answer is yes. Below you can find few good links that show you how to take screenshots with Selenium WebDriver:

1. This StackOverflow link has an example from Java, Python, Ruby, Jython [Link]

2. Taking screenshots with Selenium WebDriver (Selenium Client Driver for C#) [Link]

3. Taking screenshot of flash object using Selenium with Webdriver [Link]

4. Taking a Screenshot with Selenium Remote Webdriver - Java, Csharp, Python, Ruby [link]

5. If capture screenshot functionality with remote webdriver implementation throws Class Cast Exception [java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver cannot be cast to org.openqa.selenium.TakesScreenshot], then take a look here.

6. How to take an OS level screen capture using ruby selenium webdriver [Link]

7. How to Take Screenshots during Selenium Test Execution [Link]

Selenium - Uploading a File

Selenium - Uploading a File

If you are trying to upload a file using Selenium and are stuck then below links may help you. Below are 10 links to help you upload a file using Selenium automation testing tool.

1.
Selenium RC with Junit framework - upload a file using attachFile() method - [Link]

2.
Selenium - Uploading Files in Remote WebDriver - [Link]

3.
Selenium - Upload files on browsers running over remote machines [Link]

4.
Selenium: Upload file in Google Chrome - [Link]

5.
How to deal with file uploading in test automation using selenium or webdriver - [Link]

6.
Webdriver: File Upload - [Link]

7.
How to upload a file using Selenium in Java - [Link]

8.
How to upload a file in selenium - AutoIT - [Link]

9.
Selenium RC: How to Upload and Submit Files Using Selenium and AutoIt - [Link]

10.
Selenium Upload/Download file handling - [Link]

Wednesday, July 25, 2012

How to handle popup using Selenium RC?

Handling Popup's using Selenium RC:
 
public void testPopup() throws Exception {
    selenium.open("http://yoursitename/page.jsp");
    selenium.click("//img[@alt='Share']");
    selenium.waitForPopUp("_blank", "30000");
    selenium.selectWindow("windowId");
    verifyTrue(selenium.isTextPresent("Recommend to a friend"));
    selenium.close();
}