Tuesday, August 16, 2016

AUTOMATION 23 - GUI 10, Switching to Chrome

Technical difficulty: ****

Last week I reported on the recent changes to Selenium WebDriver.  Specifically they impacted using Firefox out-of-the-box, meaning you needed to download an position a new driver to make it work.

I was hoping it'd be all sorted by today - but alas no.  Although generally good, I'm getting issues on some basics - to confirm it's the new Gecko driver, I've tried running on Chrome, and found the issues vanish.

Update Selenium WebDriver in your project area

Switching to Chrome is relatively easy - but first we need to update our version of WebDriver used in our project.  Start with downloading the latest version of Selenium Webdriver here, and extracting it to somewhere on your system (remember where).

Under Eclipse, I've gone into my project gone Build Path -> Configure Build Path


There I've removed the previous .jar files for the last Selenium WebDriver build I've done, and then used Add External Jars to add back in all the new ones.




Put the browser driver into place

The Google Chrome driver (and indeed the Gecko driver) are a form of middleware which acts between the software of the Selenium WebDriver and the browser itself.  You'll sometimes hear the word "marionette" used to describe it, because this software essentially "pulls the strings" on your target browser.

Now, you need to download the Google Chrome Driver from here,


Now a little more tricky - to make this work it needs to be copied into your project workspace, for me it goes ...


You might notice I've also placed a version of the Firefox Gecko driver there as well.



Change your code

This is really simple - first off in your header you need to include the following,

    import org.openqa.selenium.chrome.ChromeDriver;

This includes the objects and methods needed for the ChromeDriver.  You then change your declaration of,

    WebDriver driver = new FirefoxDriver();

To ...

    WebDriver driver = new ChromeDriver();

That's pretty much it.  Although in reality there can be oddities thrown out by a change of browser - I found mine regarding the selection of frame which contains "Enter your comment".  I modified my code to use an algorithm which looked through all the frames on the page, selecting the one which says "Enter your comment" ...



I've already committed these changes to my Github page - find me there.  Really it's the second project which has had the most revision to include that frame search, which is here.

18 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work…
    Weight loss foods
    SEO
    hack

    ReplyDelete
  3. Quit 9 To 5 Academy Review is an amazing website where you get to work and learn with the professionals and then start your business in the platform of Facebook.

    ReplyDelete
  4. Eat Stop Eat Book program was one of the foremost and is not actually counted as one of the fads. It is your crucial guide but using the latest science for intermittent fasting to attain simple yet effective weight loss results.

    ReplyDelete
  5. Keto Buzz is a weight reduction formula which is used by a variety of different customer for the different desires. This supplement has the capacity to enable ketosis in your system, due to which you will be able to reduce fat faster. In addition to this, it also promotes other health benefits, making you less prone to heart risk, and cholesterol diseases. Visit On http://www.powerenrich.com/keto-buzz-weight-loss-supplement-reviews/

    ReplyDelete
  6. TimesForEducation.com - Everyday News Portal Of Education

    TimesForEducation
    https://timesforeducation.com/

    TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

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

    normal comment. TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    normal comment. TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/


    ReplyDelete
  7. Wow! This is really well organized! I like finding Information in categories like this.Absolutely love your creative idea! Can I share your post on my facebook page?

    Keto BodyTone

    ReplyDelete
  8. Thanks for share this valuable post TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    ReplyDelete
  9. I usually commit those mistakes especially when in front of the computer where I don’t really think of anything else but what’s on the screen.thnx
    Morgan @ Gowell Health Tips

    ReplyDelete
  10. Thenutritionsclinic This is one form of service you will now not need to live with out. If you do not, you could discover your self managing some harsh health troubles in later years. Bone density troubles arise with growing old as your bones lose calcium. Those makes them weaker, resulting in a condition known as osteoporosis or porous bones. Those weaker bones now are a good deal greater vulnerable to fractures, leaving you to try and keep away from any and all falls or bumps.
    https://thenutritionsclinic.com/

    ReplyDelete
  11. Valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!!
    Beauty + write for us

    ReplyDelete
  12. The Kibo code is the professionally designed training system by Steve Clayton and Aidan Booth. If anyone not sure about enrolling in the program can check for Kibo Code Reviews online to get a clear idea about the product.

    ReplyDelete
  13. Keto Enhance is the most advanced of all formulas and is on this date one of those best and popular types of weight loss pills in the market that are too rare in origin. Keto Enhance will burn down all of your fats and problems. Visit On http://www.rushyourtrial.com/coupon/keto-enhance-rush-your-weight-loss-with-this-pill/

    ReplyDelete
  14. ketogenicpedia in the direction of manufacturing of anxietyprovoking chemical compounds in preference to serotonin and melatonin (the sleep hormone). When we have enough excellent micro organism within the intestine, the opportunistic pathogenic microorganisms are typically stored in take a look at.
    https://ketogenicpedia.com/

    ReplyDelete
  15. Crypto Mojo is the one-stop destination for Crypto News basics, trading tips for bitcoin and other cryptocurrencies, price prediction, and Crypto Reviews.

    ReplyDelete
  16. Really it is nice post, The post is clearly highlighting the values of law. It is now being necessary for all of us to understand law and its values.
    Home Decor "Write for us"

    ReplyDelete
  17. Thank you for taking the chance to talk about this, I'm strongly about this and really like having to learn more about this type of field. Do you mind updating your site article with extra insight? It ought to be really beneficial for every one of us.
    How To Get Free Robux

    ReplyDelete
  18. How to resolve Facebook video not uploading?

    Instances occur when users have to struggle with Facebook video not uploading. To fix this issue, try using a different browser. Ideally, use popular browsers like Firebox, Chrome, and Opera, which are optimized by web developers most of the time. Also, clear the cache, cookies, and history from the browser to fix the issue.

    Also Read

    how do i get a human at verizon customer service
    verizon email not working
    how to make yahoo my homepage on mac
    yahoo email not syncing
    yahoo mail not working on iphone
    facebook people search not working
    deactivate facebook on iphone



    ReplyDelete