Monday, January 16, 2012

How to start chrome browser using selenium webdriver?

For starting the chrome browser follow the instructions here - http://code.google.com/p/selenium/wiki/ChromeDriver

If you find it is difficult then dont worry just download the appropriate driver associated with your OS and then use the following code -

System.setProperty("webdriver.chrome.driver","path/to/chromedriver.exe");

It is the path to your downloaded chromedriver.exe

If you have a certificate warning for your product which uses https then use the following code -

       System.setProperty("webdriver.chrome.driver","path/to/chromedriver.exe");
        DesiredCapabilities dc = DesiredCapabilities.chrome();
        String[] options = { "--ignore-certificate-errors" };
        dc.setCapability("chrome.switches", Arrays.asList(options));
        return new ChromeDriver(dc);

38 comments:

  1. hi,
    I worked on selenium webdriver how to browser and take the url in chrome browser
    this is my code
    package master2;

    import java.util.concurrent.TimeUnit;

    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebDriverBackedSelenium;
    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;


    public class ChromeTest {


    private WebDriverBackedSelenium selenium;

    @Before
    public void setUp() throws Exception {
    System.setProperty("webdriver.chrome.driver", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
    WebDriver driver = new ChromeDriver();
    driver.get("http://65.111.172.80/security/");
    selenium = new WebDriverBackedSelenium(driver,"http://65.111.172.80/security/");
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }

    @Test
    public void ChromeTest12() throws Exception {
    selenium.open("http://65.111.172.80/security/");
    selenium.type("//*[@id='User_Name']", "master1");
    selenium.type("//*[@id='Password']", "test1");
    selenium.click("//*[@id='Link']");
    selenium.waitForPageToLoad("30000");
    selenium.click("//*[@id='awesome-menu']/li[5]/a");
    selenium.waitForPageToLoad("70000");
    assert (selenium.isElementPresent("css=input[id*='hdnTimeLogDate']"));
    selenium.click("css=input[value*='day'");
    }



    @After
    public void tearDown() throws Exception {

    }
    }

    run in this code lunching to the browser but did't take the url
    any one plase suggestion me

    some error displayed:
    @Test
    public void ChromeTest12() throws Exception {

    ReplyDelete
  2. Its help me alot thanks yedukondalu

    ReplyDelete
  3. Nice information about webdriver. Really it will be helpful for both beginners and experienced professional. Your information is very clear.
    Along with your post, I put my input here.
    In your code you need to set the property for chrome driver, specify its location via the webdriver.chrome.driver as below

    System.setProperty("webdriver.chrome.driver", "pathofchromedriver\\chromedriver.exe");
    WebDriver driver=new ChromeDriver(); // this line launch chrome browser
    driver.get("http://www.google.co.in");

    If your audience is also interested in Selenium Testing, they can take a look here: Selenium Training

    ReplyDelete
  4. Wow! That's really great information guys.I know lot of new things here.

    QTP Tutorial

    ReplyDelete
  5. I Just Love to read Your Articles Because they are very easy to understand USMLE Thank you.

    ReplyDelete
  6. Really Thanks For Posting Such an Useful and informative article. Mulesoft Certification Training

    ReplyDelete
  7. Thanks for sharing Such an useful information...

    Vizag Real Estate

    ReplyDelete
  8. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
    Hadoop Training in Chennai
    Hadoop Training in Bangalore
    Big data training in tambaram
    Big data training in Sholinganallur
    Big data training in annanagar
    Big data training in Velachery
    Big data training in Marathahalli

    ReplyDelete
  9. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Devops Training in Chennai

    Devops Training in Bangalore

    Devops Training in pune

    Devops training in tambaram
    Devops training in velachery

    ReplyDelete
  10. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    python training in rajajinagar
    Python training in btm
    Python training in usa

    ReplyDelete
  11. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.

    java training in marathahalli | java training in btm layout

    java training in jayanagar | java training in electronic city

    ReplyDelete
  12. Thank you for this post. Thats all I are able to say. You most absolutely have built this blog website into something speciel. You clearly know what you are working on, youve insured so many corners.thanks

    Data Science course in rajaji nagar | Data Science with Python course in chenni
    Data Science course in electronic city | Data Science course in USA
    Data science course in pune | Data science course in kalyan nagar

    ReplyDelete
  13. Hi, I have read your blog and I gathered some needful information from this blog. Thanks for sharing. Keep updating your blog.

    Oracle course in Chennai
    Oracle Training
    Oracle Certification in Chennai
    Best VMware Training
    VMware course in Chennai
    VMware Course

    ReplyDelete
  14. Howdy, would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 completely different web browsers, and I must say this blog loads a lot quicker than most. Can you suggest a good internet hosting provider at a reasonable price?


    Best AWS Training Institute in BTM Layout Bangalore ,AWS Coursesin BTM


    Best AWS Training in Marathahalli | AWS Training in Marathahalli

    Amazon Web Services Training in Jaya Nagar | Best AWS Training in Jaya Nagar


    ReplyDelete
  15. For Hadoop Training in Bangalore Visit:Hadoop Training in Bangalore

    ReplyDelete
  16. I just recently discovered your blog and have now scrolled through the entire thing several times. I am very impressed and inspired by your skill and creativity, and your "style" is very much in line with mine. I hope you keep blogging and sharing your design idea

    oracle training in chennai

    oracle training in velachery

    oracle dba training in chennai

    oracle dba training in velachery

    ccna training in chennai

    ccna training in velachery

    seo training in chennai

    seo training in velachery

    ReplyDelete
  17. Title:
    Best Oracle Training in Chennai | Infycle Technologies

    Description:
    Ge set your career towards Oracle with the best Oracle training in Chennai with Infycle Technologies. Infycle offers the best software courses such as Big Data, Java, Python, Hadoop, etc in a complete hands-on training tutored by professionals in the field. Apart from the training, the mock interviews for the placement will be given, so that, they can face the interviews with full confidence. While completing the mock interview, the candidates will be placed in the top MNC's with a great salary package. For all this, call 7502633633 and make this happen for your happy life.

    BEst training in Chennai

    ReplyDelete
  18. Title:
    Oracle PLSQL Training in Chennai | Infycle Technologies


    Description:
    Learn Oracle PLSQL Training in Chennai for excellent job opportunities from Infycle Technologies, the best Oracle Training Institute in Chennai. Infycle Technologies is the best & trustworthy software training center in Chennai, applies full hands-on practical training with professional trainers in the field. In addition to that, the mock placement interviews will be arranged by the alumni for the candidates, so that, they can meet the job interviews without missing them. For transforming your career to a higher level call 7502633633 to Infycle Technologies & grab a free demo session to know more.

    Best training in Chennai

    ReplyDelete

  19. Excellent blog. Lots of useful information here, thanks for your effort!
    Real Estate Plots in Vizag

    ReplyDelete
  20. Title:
    Oracle PLSQL Training in Chennai | Infycle Technologies


    Description:
    Learn Oracle PLSQL Training in Chennai for excellent job opportunities from Infycle Technologies, the best Oracle Training Institute in Chennai. Infycle Technologies is the best & trustworthy software training center in Chennai, applies full hands-on practical training with professional trainers in the field. In addition to that, the mock placement interviews will be arranged by the alumni for the candidates, so that, they can meet the job interviews without missing them. For transforming your career to a higher level call 7502633633 to Infycle Technologies & grab a free demo session to know more.
    best training institute in chennai

    ReplyDelete
  21. nices information thanku so much this information

    ReplyDelete
  22. Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.

    ReplyDelete
  23. Excellent blog. Lots of useful information here, thanks for your effort!
    jewellery erp software
    Jewellery erp software

    ReplyDelete