December 27, 2011

Web Driver Backed Selenium -- Sample script

The Java version of WebDriver provides an implementation of the Selenium-RC API. These means that you can use the underlying WebDriver technology using the Selenium-RC API. This is primarily provided for backwards compatablity. It allows those who have existing test suites using the Selenium-RC API to use WebDriver under the covers. It’s provided to help ease the migration path to Selenium-Web driver.


Sample Backed web driver script looks like this:


=================================================================



package webone;


import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.thoughtworks.selenium.SeleneseTestCase;
import com.thoughtworks.selenium.Selenium;
@SuppressWarnings("deprecation")
public class BackedSelenium extends SeleneseTestCase  {

//web driver --here we are declaring the browser
WebDriver driver = new FirefoxDriver();
@Before
public void setUp() throws Exception {

String baseUrl = "http://www.google.co.in/";
selenium = new WebDriverBackedSelenium(driver, baseUrl);
}


@Test
public void testBackedSelenium() throws Exception {
//This is using selenium
selenium.open("/");
selenium.click("id=gbi5");
selenium.click("id=gmlas");
selenium.waitForPageToLoad("30000");
selenium.type("name=as_q", "test");
//Here we are using Webdriver
driver.findElement(By.id("as_oq1")).sendKeys("naga");

driver.findElement(By.id("as_oq2")).sendKeys("Webdriver");
Thread.sleep(5000);

}


@After
public void tearDown() throws Exception {
selenium.stop();
}
}

=====================================================

By using the above format you can use both the Selenium API and Web driver API...



56 comments:

  1. Hello there! This post could not be written any
    better! Reading through this article reminds me of my previous roommate!
    He constantly kept preaching about this.

    I most certainly will forward this article
    to him. Pretty sure he will have a great read.
    Thank you for sharing!

    Here is my web page Buy Green Coffee Cleanse

    ReplyDelete
  2. I really like reading a post that will make men and women think.
    Also, thank you for allowing me to comment!

    Also visit my page; Muscle Core X Reviews

    ReplyDelete
  3. Hi! This is kind of off topic but I need some help from an established blog.
    Is it tough to set up your own blog? I'm not very techincal but I can figure things out pretty quick. I'm thinking about creating my
    own but I'm not sure where to begin. Do you have any tips or suggestions? Thank you

    my web site: Muscle rev xtreme reviews

    ReplyDelete
  4. This is my first time pay a visit at here
    and i am actually pleassant to read everthing at alone place.


    Here is my web blog; Xength X1

    ReplyDelete
  5. Everything posted made a great deal of sense. But, think on
    this, suppose you were to write a awesome post title? I am not saying your content isn't good., however what if you added something that grabbed people's attention?
    I mean "Web Driver Backed Selenium -- Sample script" is a little vanilla.
    You should peek at Yahoo's home page and note how they write post titles to grab viewers interested. You might add a related video or a related pic or two to grab readers excited about what you've
    written. In my opinion, it could bring your posts a little livelier.



    turbo force review

    ReplyDelete
  6. Very good post. I'm experiencing some of these issues as well..

    My blog post - Lift and Glow Pro Review

    ReplyDelete
  7. Woah! I'm really digging the template/theme of this site. It's simple, yet effective.

    A lot of times it's very difficult to get that "perfect balance" between superb usability and visual appeal. I must say you have done a great job with this. Also, the blog loads very fast for me on Safari. Outstanding Blog!

    my website ... Green coffee reviews

    ReplyDelete
  8. I'm really enjoying the design and layout of your website. It's a very easy on the eyes which makes it much more enjoyable for me to come here and visit
    more often. Did you hire out a designer to create your theme?
    Outstanding work!

    Enduros Male Enhancement Website

    ReplyDelete
  9. Attractive section of content. I just stumbled upon your weblog and in accession capital to assert
    that I acquire actually enjoyed account your
    blog posts. Anyway I will be subscribing to your augment
    and even I achievement you access consistently fast.

    Also visit my blog - real online jobs

    ReplyDelete
  10. Hey! Someone in my Facebook group shared this site
    with us so I came to check it out. I'm definitely enjoying the information. I'm bookmarking
    and will be tweeting this to my followers! Wonderful blog and brilliant design.


    Look at my website ... 365 day loans

    ReplyDelete
  11. a week and also transform your physique very quickly.

    Single species protein is assimilated so quickly that it is often burned as fuel inhibiting the burning of your stored body fat.

    If you want to get bigger arms, finding the great ways to build muscle can
    be a bit.

    My web-site ... Power Pump XL Review

    ReplyDelete
  12. Whats up very nice web site!! Guy .. Beautiful .
    . Superb .. I will bookmark your blog and take the feeds additionally?

    I am satisfied to seek out a lot of useful info here within the publish, we need develop extra
    strategies on this regard, thanks for sharing. . . .
    . .

    my web blog Order Acai Energize

    ReplyDelete
  13. I enjoy what you guys are up too. This kind of clever work
    and exposure! Keep up the good works guys I've added you guys to my blogroll.


    amnio prime review

    ReplyDelete
  14. Hi aravind,
    In declaration u have mentioned
    selenium = new WebDriverBackedSelenium(driver, baseUrl);

    What should be before of selenium

    ReplyDelete
  15. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks! A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article.

    selenium training in bangalore|

    ReplyDelete
  16. I’ve bookmarked your site, and I’m adding your RSS feeds to my Google account.
    <a href="http://www.traininginmarathahalli.in/dot-net-training-in-bangalore/”> Dotnet Training in Marathahalli </a>|

    ReplyDelete
  17. I accept there are numerous more pleasurable open doors ahead for people that took a gander at your site.
    R Programming Training in Chennai

    ReplyDelete
  18. I simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation. Selenium Training In Bangalore | Best Selenium Training in Bangalore

    ReplyDelete
  19. I wish to indicate because of you only to bail me out of this specific trouble. As a consequence of checking through the net and meeting systems that were not beneficial, I thought my life was finished.offshore safety course in Chennai

    ReplyDelete


  20. Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
    Software testing course in chennai

    ReplyDelete

  21. Yiioverflow presenting one of the best and high performance PHP framework. Fast, secure and extremely professionals are developing applications. We guide to implement mobile app development and SOA hybrid applications.Code in Nodejs, Angular,Ionic,ReactJS and Yiiframework.

    ReplyDelete
  22. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts, have a nice weekend!
    Online training in USA

    ReplyDelete
  23. I am really enjoying reading your well-written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
    RPA Training in Chennai
    RPA course
    Robotic Process Automation Certification
    RPA Training
    RPA Training Institute in Chennai
    Robotic Process Automation Courses

    ReplyDelete
  24. Hi,
    I must appreciate you for providing such a valuable content for us. This is one amazing piece of article. Helped a lot in increasing my knowledge.
    German Training Institutes in Chennai
    German Training Chennai
    German Training Centers in Chennai
    German Training Institute in Chennai
    German language coaching centres in chennai

    ReplyDelete
  25. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us. Do check R Programming Course Fees & Get trained by an expert who will enrich you with the latest trends.

    ReplyDelete
  26. feeling so good to read your information's in the blog.
    thanks for sharing your ideas with us and add more info.
    Java Classes in Bangalore
    Java Training in Ambattur
    Java Training in Saidapet
    Java Training Institutes in OMR

    ReplyDelete
  27. Hi,
    I must appreciate you for providing such a valuable content for us. This is one amazing piece of article. Helped a lot in increasing my knowledge.
    Java Training in Chennai
    PHP Training in Chennai
    Java Classes in Chennai
    Core Java Training in Chennai
    PHP Training Center in Chennai
    PHP Institutes in Chennai

    ReplyDelete
  28. Great survey, I'm sure you're getting a great response. learners test

    ReplyDelete
  29. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. drivers knowledge test

    ReplyDelete
  30. Such great information for blogger iam a professional blogger thanks…

    Looking for Data Stage Training in Bangalore, learn from Softgen Infotech provide Data StageTraining on online training and classroom training. Join today!

    ReplyDelete
  31. Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have. DCS, Dacor, NXR, Wolf, Viking, Cove OVEN REPAIR IN HIGHLAND

    ReplyDelete
  32. On this subject internet page, you'll see my best information, be sure to look over this level of detail. Cryptocurrency

    ReplyDelete